Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 50 additions & 23 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04

ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}

# Install essential packages first
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
sudo \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy ASDF version file
ARG ASDF_VERSION
COPY .tool-versions.asdf /tmp/.tool-versions.asdf

# Add amd64 architecture if on arm64
RUN if [ "$TARGETARCH" == "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then dpkg --add-architecture amd64; fi

RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
Expand All @@ -9,33 +29,42 @@ RUN apt-get update \
jq apt-transport-https ca-certificates gnupg-agent \
software-properties-common bash-completion python3-pip make libbz2-dev \
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev
xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev uuid-runtime xxd unzip

# install aws stuff
RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
# Download correct AWS CLI for arch
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"; \
else \
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"; \
fi && \
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
/tmp/aws-cli/aws/install && \
rm tmp/awscliv2.zip && \
rm -rf /tmp/aws-cli
rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli

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 && \
unzip /tmp/aws-sam-cli.zip -d /tmp/aws-sam-cli && \
/tmp/aws-sam-cli/install && \
rm /tmp/aws-sam-cli.zip && \
rm -rf /tmp/aws-sam-cli
# Install ASDF
RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
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"; \
else \
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"; \
fi && \
tar -xzf /tmp/asdf.tar.gz -C /tmp && \
mkdir -p /usr/bin && \
mv /tmp/asdf /usr/bin/asdf && \
chmod +x /usr/bin/asdf && \
rm -rf /tmp/asdf.tar.gz

USER vscode

# Install ASDF
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0; \
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; \
ENV PATH="/home/vscode/.asdf/shims/:$PATH:/workspaces/eps-loadtest/node_modules/.bin"
RUN \
echo 'PATH="/home/vscode/.asdf/shims/:$PATH:/workspaces/eps-loadtest/node_modules/.bin"' >> ~/.bashrc; \
echo '. <(asdf completion bash)' >> ~/.bashrc; \
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;

ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-status-update-api/node_modules/.bin"


# Install ASDF plugins
RUN asdf plugin add python; \
Expand All @@ -47,12 +76,10 @@ RUN asdf plugin add python; \
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git


WORKDIR /workspaces/eps-prescription-status-update-api
ADD .tool-versions /workspaces/eps-prescription-status-update-api/.tool-versions
WORKDIR /workspaces/eps-loadtest
ADD .tool-versions /workspaces/eps-loadtest/.tool-versions
ADD .tool-versions /home/vscode/.tool-versions

RUN asdf install; \
asdf reshim python; \
asdf reshim poetry; \
asdf reshim nodejs; \
asdf direnv setup --shell bash --version 2.32.2;
# install python before poetry to ensure correct python version is used
RUN asdf install python; \
asdf install
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nodejs 20.10.0
python 3.12.2
poetry 1.8.2
nodejs 24.12.0
python 3.14.2
poetry 2.2.1
shellcheck 0.9.0
direnv 2.32.2
actionlint 1.6.26
2 changes: 2 additions & 0 deletions .tool-versions.asdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# define the .asdf-version to use here
0.18.0
Loading