Skip to content

Commit

Permalink
Merge pull request #3 from futabooo/fix-devcontainer
Browse files Browse the repository at this point in the history
update devcontainer
  • Loading branch information
futabooo authored Aug 11, 2024
2 parents a972379 + fe23a12 commit 445865c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 527 deletions.
37 changes: 12 additions & 25 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
# Update VARIANT in devcontainer.json to pick a Dart version
ARG VARIANT=2
ARG VARIANT=3.5
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"
# 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 \
Expand Down
56 changes: 32 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/dart
{
"name": "Dart",
"build": {
"dockerfile": "Dockerfile",
// Update VARIANT to pick a Dart version
"args": {
"VARIANT": "2",
"UPGRADE_PACKAGES": "true"
}
},
"name": "Dart",
"build": {
"dockerfile": "./Dockerfile",
// Update VARIANT to pick a Dart version
"args": {
"VARIANT": "3.5",
"UPGRADE_PACKAGES": "true"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dart-code.dart-code"
],
// 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"]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
Loading

0 comments on commit 445865c

Please sign in to comment.