|
1 | | -FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 |
2 | | -ARG TARGETARCH |
3 | | -ENV TARGETARCH=${TARGETARCH} |
4 | | - |
5 | | -# Install essential packages first |
6 | | -RUN apt-get update && apt-get install -y \ |
7 | | - curl \ |
8 | | - wget \ |
9 | | - git \ |
10 | | - sudo \ |
11 | | - unzip \ |
12 | | - && apt-get clean \ |
13 | | - && rm -rf /var/lib/apt/lists/* |
14 | | - |
15 | | -# Copy ASDF version file |
16 | | -ARG ASDF_VERSION |
17 | | -COPY .tool-versions.asdf /tmp/.tool-versions.asdf |
18 | | - |
19 | | -# Add amd64 architecture if on arm64 |
20 | | -RUN if [ "$TARGETARCH" == "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then dpkg --add-architecture amd64; fi |
21 | | - |
22 | | -RUN apt-get update \ |
23 | | - && export DEBIAN_FRONTEND=noninteractive \ |
24 | | - && apt-get -y dist-upgrade \ |
25 | | - && apt-get -y install --no-install-recommends htop vim curl git build-essential \ |
26 | | - libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \ |
27 | | - zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \ |
28 | | - jq apt-transport-https ca-certificates gnupg-agent \ |
29 | | - software-properties-common bash-completion python3-pip make libbz2-dev \ |
30 | | - libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \ |
31 | | - xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev uuid-runtime xxd unzip |
32 | | - |
33 | | -# install aws stuff |
34 | | -# Download correct AWS CLI for arch |
35 | | -RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \ |
36 | | - wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"; \ |
37 | | - else \ |
38 | | - wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"; \ |
39 | | - fi && \ |
40 | | - unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \ |
41 | | - /tmp/aws-cli/aws/install && \ |
42 | | - rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli |
43 | | - |
44 | | -# Install ASDF |
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"; \ |
| 1 | +ARG IMAGE_NAME=node_24_python_3_14 |
| 2 | +ARG IMAGE_VERSION=latest |
| 3 | +FROM ghcr.io/nhsdigital/eps-devcontainers/${IMAGE_NAME}:${IMAGE_VERSION} |
| 4 | + |
| 5 | +USER root |
| 6 | +# specify DOCKER_GID to force container docker group id to match host |
| 7 | +RUN if [ -n "${DOCKER_GID}" ]; then \ |
| 8 | + if ! getent group docker; then \ |
| 9 | + groupadd -g ${DOCKER_GID} docker; \ |
48 | 10 | 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"; \ |
| 11 | + groupmod -g ${DOCKER_GID} docker; \ |
50 | 12 | fi && \ |
51 | | - tar -xzf /tmp/asdf.tar.gz -C /tmp && \ |
52 | | - mkdir -p /usr/bin && \ |
53 | | - mv /tmp/asdf /usr/bin/asdf && \ |
54 | | - chmod +x /usr/bin/asdf && \ |
55 | | - rm -rf /tmp/asdf.tar.gz |
56 | | - |
57 | | -# install gitsecrets |
58 | | -RUN git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets && \ |
59 | | - cd /tmp/git-secrets && \ |
60 | | - make install && \ |
61 | | - cd && \ |
62 | | - rm -rf /tmp/git-secrets && \ |
63 | | - mkdir -p /usr/share/secrets-scanner && \ |
64 | | - chmod 755 /usr/share/secrets-scanner && \ |
65 | | - curl -L https://raw.githubusercontent.com/NHSDigital/software-engineering-quality-framework/main/tools/nhsd-git-secrets/nhsd-rules-deny.txt -o /usr/share/secrets-scanner/nhsd-rules-deny.txt |
66 | | - |
67 | | -USER vscode |
68 | | - |
69 | | -ENV PATH="/home/vscode/.asdf/shims/:$PATH:/workspaces/eps-devcontainers/node_modules/.bin" |
70 | | -RUN \ |
71 | | - echo 'PATH="/home/vscode/.asdf/shims/:$PATH:/workspaces/eps-devcontainers/node_modules/.bin"' >> ~/.bashrc; \ |
72 | | - echo '. <(asdf completion bash)' >> ~/.bashrc; \ |
73 | | - echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \ |
74 | | - echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \ |
75 | | - echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc; |
76 | | - |
77 | | -# Install ASDF plugins |
78 | | -RUN asdf plugin add python; \ |
79 | | - asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \ |
80 | | - asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \ |
81 | | - asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \ |
82 | | - asdf plugin add direnv; \ |
83 | | - asdf plugin add actionlint; \ |
84 | | - asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git; \ |
85 | | - asdf plugin add trivy https://github.com/zufardhiyaulhaq/asdf-trivy.git; \ |
86 | | - asdf plugin add yq https://github.com/sudermanjr/asdf-yq.git |
87 | | - |
88 | | - |
89 | | -WORKDIR /workspaces/eps-devcontainers |
90 | | -COPY .tool-versions /workspaces/eps-devcontainers/.tool-versions |
91 | | -COPY .tool-versions /home/vscode/.tool-versions |
92 | | - |
93 | | -# install python before poetry to ensure correct python version is used |
94 | | -RUN asdf install python; \ |
95 | | - asdf install |
96 | | - |
97 | | -RUN git-secrets --register-aws --global && \ |
98 | | - git-secrets --add-provider --global -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt |
| 13 | + usermod -aG docker vscode; \ |
| 14 | + fi |
0 commit comments