1- FROM mcr.microsoft.com/devcontainers/base:ubuntu
1+ FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
2+
3+ ARG TARGETARCH
4+ ENV TARGETARCH=${TARGETARCH}
5+
6+ # Install essential packages first
7+ RUN apt-get update && apt-get install -y \
8+ curl \
9+ wget \
10+ git \
11+ sudo \
12+ unzip \
13+ && apt-get clean \
14+ && rm -rf /var/lib/apt/lists/*
15+
16+ # Copy ASDF version file
17+ ARG ASDF_VERSION
18+ COPY .tool-versions.asdf /tmp/.tool-versions.asdf
19+
20+ # Add amd64 architecture if on arm64
21+ RUN if [ "$TARGETARCH" == "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then dpkg --add-architecture amd64; fi
222
323RUN apt-get update \
424 && export DEBIAN_FRONTEND=noninteractive \
@@ -9,33 +29,42 @@ RUN apt-get update \
929 jq apt-transport-https ca-certificates gnupg-agent \
1030 software-properties-common bash-completion python3-pip make libbz2-dev \
1131 libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
12- xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev
32+ xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev uuid-runtime xxd unzip
1333
1434# install aws stuff
15- RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
35+ # Download correct AWS CLI for arch
36+ RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
37+ wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" ; \
38+ else \
39+ wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" ; \
40+ fi && \
1641 unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
1742 /tmp/aws-cli/aws/install && \
18- rm tmp/awscliv2.zip && \
19- rm -rf /tmp/aws-cli
43+ rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
2044
21- 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 && \
22- unzip /tmp/aws-sam-cli.zip -d /tmp/aws-sam-cli && \
23- /tmp/aws-sam-cli/install && \
24- rm /tmp/aws-sam-cli.zip && \
25- rm -rf /tmp/aws-sam-cli
45+ # Install ASDF
46+ RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
47+ if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
48+ 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" ; \
49+ else \
50+ 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" ; \
51+ fi && \
52+ tar -xzf /tmp/asdf.tar.gz -C /tmp && \
53+ mkdir -p /usr/bin && \
54+ mv /tmp/asdf /usr/bin/asdf && \
55+ chmod +x /usr/bin/asdf && \
56+ rm -rf /tmp/asdf.tar.gz
2657
2758USER vscode
2859
29- # Install ASDF
30- RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0; \
31- echo '. $HOME/ .asdf/asdf.sh ' >> ~/.bashrc; \
32- echo '. $HOME/. asdf/completions/asdf. bash' >> ~/.bashrc; \
60+ ENV PATH= "/home/vscode/.asdf/shims/:$PATH:/workspaces/eps-loadtest/node_modules/.bin"
61+ RUN \
62+ echo 'PATH="/home/vscode/ .asdf/shims/:$PATH:/workspaces/eps-loadtest/node_modules/.bin" ' >> ~/.bashrc; \
63+ echo '. <( asdf completion bash) ' >> ~/.bashrc; \
3364 echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
3465 echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
3566 echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
3667
37- ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-status-update-api/node_modules/.bin"
38-
3968
4069# Install ASDF plugins
4170RUN asdf plugin add python; \
@@ -47,12 +76,10 @@ RUN asdf plugin add python; \
4776 asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
4877
4978
50- WORKDIR /workspaces/eps-prescription-status-update-api
51- ADD .tool-versions /workspaces/eps-prescription-status-update-api /.tool-versions
79+ WORKDIR /workspaces/eps-loadtest
80+ ADD .tool-versions /workspaces/eps-loadtest /.tool-versions
5281ADD .tool-versions /home/vscode/.tool-versions
5382
54- RUN asdf install; \
55- asdf reshim python; \
56- asdf reshim poetry; \
57- asdf reshim nodejs; \
58- asdf direnv setup --shell bash --version 2.32.2;
83+ # install python before poetry to ensure correct python version is used
84+ RUN asdf install python; \
85+ asdf install
0 commit comments