11FROM mcr.microsoft.com/devcontainers/base:ubuntu
22
3+ # provide DOCKER_GID via build args if you need to force group id to match host
4+ ARG DOCKER_GID
35ARG TARGETARCH
46ENV TARGETARCH=${TARGETARCH}
57
68ARG ASDF_VERSION
79COPY .tool-versions.asdf /tmp/.tool-versions.asdf
810
11+ # Anticipate and resolve potential permission issues with apt
12+ RUN mkdir -p /tmp && chmod 1777 /tmp
13+
914RUN apt-get update \
1015 && export DEBIAN_FRONTEND=noninteractive \
1116 && apt-get -y dist-upgrade \
@@ -18,7 +23,7 @@ RUN apt-get update \
1823 xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev
1924
2025# Download correct AWS CLI for arch
21- RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
26+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
2227 wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" ; \
2328 else \
2429 wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" ; \
@@ -28,7 +33,7 @@ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
2833 rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
2934
3035# Download correct SAM CLI for arch
31- RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
36+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
3237 wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-arm64.zip" ; \
3338 else \
3439 wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip" ; \
@@ -43,6 +48,16 @@ RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf)
4348 tar -xvzf /tmp/asdf.tar.gz; \
4449 mv asdf /usr/bin
4550
51+ # specify DOCKER_GID to force container docker group id to match host
52+ RUN if [ -n "${DOCKER_GID}" ]; then \
53+ if ! getent group docker; then \
54+ groupadd -g ${DOCKER_GID} docker; \
55+ else \
56+ groupmod -g ${DOCKER_GID} docker; \
57+ fi && \
58+ usermod -aG docker vscode; \
59+ fi
60+
4661USER vscode
4762
4863ENV PATH="/home/vscode/.asdf/shims/:$PATH"
@@ -54,15 +69,15 @@ RUN \
5469 echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
5570
5671# Install ASDF plugins
57- RUN asdf plugin add python; \
58- asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
59- asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
60- asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \
61- asdf plugin add java; \
62- asdf plugin add direnv; \
63- asdf plugin add golang https://github.com/kennyp/asdf-golang.git; \
64- asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git; \
65- asdf plugin add actionlint; \
72+ RUN asdf plugin add python && \
73+ asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
74+ asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
75+ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
76+ asdf plugin add java && \
77+ asdf plugin add direnv && \
78+ asdf plugin add golang https://github.com/kennyp/asdf-golang.git && \
79+ asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git && \
80+ asdf plugin add actionlint && \
6681 asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
6782
6883
@@ -71,5 +86,5 @@ ADD .tool-versions /workspaces/prescriptionsforpatients/.tool-versions
7186ADD .tool-versions /home/vscode/.tool-versions
7287
7388# install python before poetry to ensure correct python version is used
74- RUN asdf install python; \
89+ RUN asdf install python && \
7590 asdf install
0 commit comments