diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 83858e4..c804ab0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,21 @@ FROM mcr.microsoft.com/devcontainers/base:ubuntu +# provide DOCKER_GID via build args if you need to force group id to match host +ARG DOCKER_GID + +# specify DOCKER_GID to force container docker group id to match host +RUN if [ -n "${DOCKER_GID}" ]; then \ + if ! getent group docker; then \ + groupadd -g ${DOCKER_GID} docker; \ + else \ + groupmod -g ${DOCKER_GID} docker; \ + fi && \ + usermod -aG docker vscode; \ + fi + +# Anticipate and resolve potential permission issues with apt +RUN mkdir -p /tmp && chmod 1777 /tmp + RUN apt-get update \ && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y dist-upgrade \ @@ -14,17 +30,17 @@ RUN apt-get update \ USER vscode # Install ASDF -RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \ - echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \ - echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; +RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 && \ + echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc && \ + echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin:/workspaces/eps-workflow-quality-checks/.venv/bin" # Install ASDF plugins# -RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \ - asdf plugin add actionlint; \ - asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \ - asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \ +RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \ + asdf plugin add actionlint && \ + asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \ + asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \ asdf plugin add python WORKDIR /workspaces/eps-workflow-quality-checks @@ -32,6 +48,6 @@ WORKDIR /workspaces/eps-workflow-quality-checks ADD .tool-versions /workspaces/eps-workflow-quality-checks/.tool-versions ADD .tool-versions /home/vscode/.tool-versions -RUN asdf install python; \ - asdf install; \ - asdf reshim nodejs; +RUN asdf install python && \ + asdf install && \ + asdf reshim nodejs diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9806958..570ec2a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,9 @@ "build": { "dockerfile": "Dockerfile", "context": "..", - "args": {} + "args": { + "DOCKER_GID": "${env:DOCKER_GID:}" + } }, "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",