11FROM mcr.microsoft.com/devcontainers/base:ubuntu
22
3+ ARG TARGETARCH
4+ ENV TARGETARCH=${TARGETARCH}
5+
6+ ARG ASDF_VERSION
7+ COPY .tool-versions.asdf /tmp/.tool-versions.asdf
8+
9+ # Add amd64 architecture if on arm64
10+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then dpkg --add-architecture amd64; fi
11+
312RUN apt-get update \
413 && export DEBIAN_FRONTEND=noninteractive \
514 && apt-get -y dist-upgrade \
@@ -9,50 +18,63 @@ RUN apt-get update \
918 jq apt-transport-https ca-certificates gnupg-agent \
1019 software-properties-common bash-completion python3-pip make libbz2-dev \
1120 libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
12- xz-utils tk-dev liblzma-dev netcat ruby-full build-essential zlib1g-dev \
21+ xz-utils tk-dev liblzma-dev netcat-traditional ruby-full build-essential zlib1g-dev \
1322 && apt remove -y openjdk-8-jdk-headless openjdk-8-jre-headless openjdk-8-jre
1423
15- # install aws stuff
16- RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
24+ # Download correct AWS CLI for arch
25+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
26+ wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" ; \
27+ else \
28+ wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" ; \
29+ fi && \
1730 unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
1831 /tmp/aws-cli/aws/install && \
19- rm tmp/awscliv2.zip && \
20- rm -rf /tmp/aws-cli
21-
22- RUN wget -O /tmp/aws-sam-cli.zip https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip && \
32+ rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
33+
34+ # Download correct SAM CLI for arch
35+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
36+ wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-arm64.zip" ; \
37+ else \
38+ wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip" ; \
39+ fi && \
2340 unzip /tmp/aws-sam-cli.zip -d /tmp/aws-sam-cli && \
2441 /tmp/aws-sam-cli/install && \
25- rm /tmp/aws-sam-cli.zip && \
26- rm -rf /tmp/aws-sam-cli
27-
28- USER vscode
42+ rm /tmp/aws-sam-cli.zip && rm -rf /tmp/aws-sam-cli
2943
3044# Install ASDF
31- RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
32- echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
33- echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; \
45+ RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
46+ if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
47+ wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz; \
48+ else \
49+ wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz; \
50+ fi && \
51+ tar -xvzf /tmp/asdf.tar.gz && \
52+ mv asdf /usr/bin
53+
54+
55+ USER vscode
56+
57+ ENV PATH="/home/vscode/.asdf/shims/:$PATH"
58+ RUN \
59+ echo 'PATH="/home/vscode/.asdf/shims/:$PATH"' >> ~/.bashrc; \
60+ echo '. <(asdf completion bash)' >> ~/.bashrc; \
3461 echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
3562 echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
3663 echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
3764
38- ENV PATH="$PATH:/home/vscode/.asdf/bin/"
39-
40-
4165# Install ASDF plugins
42- RUN asdf plugin add python; \
43- asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
44- asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
45- asdf plugin- add java; \
46- asdf plugin- add maven; \
47- asdf plugin add direnv; \
48- asdf plugin add actionlint; \
66+ RUN asdf plugin add python && \
67+ asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
68+ asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
69+ asdf plugin add java && \
70+ asdf plugin add maven && \
71+ asdf plugin add direnv && \
72+ asdf plugin add actionlint && \
4973 asdf plugin add nodejs;
5074
5175WORKDIR /workspaces/validation-service-fhir-r4
5276ADD .tool-versions /workspaces/validation-service-fhir-r4/.tool-versions
5377ADD .tool-versions /home/vscode/.tool-versions
5478
55- RUN asdf install; \
56- asdf reshim python; \
57- asdf reshim poetry; \
58- asdf reshim java;
79+ RUN asdf install python && \
80+ asdf install
0 commit comments