Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev container initial setup #871

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Update VARIANT in devcontainer.json to pick a Dart version
ARG VARIANT=2
FROM dart:${VARIANT}

# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
ARG UPGRADE_PACKAGES="false"

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apt-get update && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts

# Add bin location to path
ENV PUB_CACHE="/usr/local/share/pub-cache"
ENV PATH="${PUB_CACHE}/bin:${PATH}"
RUN if ! cat /etc/group | grep -e "^pub-cache:" > /dev/null 2>&1; then groupadd -r pub-cache; fi \
&& usermod -a -G pub-cache ${USERNAME} \
&& umask 0002 \
&& mkdir -p ${PUB_CACHE} \
&& chown :pub-cache ${PUB_CACHE} \
&& sed -i -e "s/export PATH=/export PATH=\/usr\/local\/share\/pub-cache:/" /etc/profile.d/00-restore-env.sh \
#
# Fix incorrect privs if present on directories - https://github.com/dart-lang/dart-docker/issues/62, https://github.com/dart-lang/sdk/issues/47093
&& chmod 755 "$DART_SDK" "$DART_SDK/bin"

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Dart (Community)",
"build": {
"dockerfile": "Dockerfile",
// Update VARIANT to pick a Dart version
"args": {
"VARIANT": "2"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["dart-code.dart-code"]
}
},
// Run script when connecting to remote container that setups up flutter version, java version and accepts android licenses
"postStartCommand": "sh /workspaces/Notre-Dame/.devcontainer/library-scripts/applets-setup.sh",

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root",

"features": {
"ghcr.io/jarrodcolburn/features/flutter-sdk:0": {},
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {}
}
}
17 changes: 17 additions & 0 deletions .devcontainer/library-scripts/applets-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#/bin/bash


# setup flutter
cd /flutter
git checkout 3.3.10
# Prepares flutter dependencies
flutter precache
cd /workspaces/Notre-Dame
flutter pub get

# This requires user input to accept the licenses but can't be run on java 11 so we run it before switch
flutter doctor --android-licenses


# set java version
update-java-alternatives -s java-1.11.0-openjdk-amd64
Loading
Loading