Skip to content

Commit 9af4241

Browse files
committed
revert
1 parent 4456909 commit 9af4241

7 files changed

Lines changed: 179 additions & 142 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 96 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,98 @@
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; \
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"; \
1048
else \
11-
groupmod -g ${DOCKER_GID} docker; \
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"; \
1250
fi && \
13-
usermod -aG docker vscode; \
14-
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

.devcontainer/devcontainer.json

Lines changed: 83 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,86 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
13
{
2-
"name": "eps-devcontainers",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": "..",
6-
"args": {
7-
"DOCKER_GID": "${env:DOCKER_GID:}",
8-
"IMAGE_NAME": "node_24_python_3_14",
9-
"IMAGE_VERSION": "v1.0.4",
10-
"USER_UID": "${localEnv:USER_ID:}",
11-
"USER_GID": "${localEnv:GROUP_ID:}"
4+
"name": "eps-devcontainers",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
"context": "..",
9+
"args": {}
1210
},
13-
"updateRemoteUserUID": false
14-
},
15-
"postAttachCommand": "git-secrets --register-aws; git-secrets --add-provider -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt",
16-
"mounts": [
17-
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
18-
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
19-
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
20-
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind"
21-
],
22-
"runArgs": [
23-
"--network=host"
24-
],
25-
"remoteEnv": {
26-
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
27-
},
28-
"features": {},
29-
"customizations": {
30-
"vscode": {
31-
"extensions": [
32-
"AmazonWebServices.aws-toolkit-vscode",
33-
"redhat.vscode-yaml",
34-
"ms-python.python",
35-
"ms-python.flake8",
36-
"eamodio.gitlens",
37-
"github.vscode-pull-request-github",
38-
"orta.vscode-jest",
39-
"42crunch.vscode-openapi",
40-
"mermade.openapi-lint",
41-
"christian-kohler.npm-intellisense",
42-
"dbaeumer.vscode-eslint",
43-
"lfm.vscode-makefile-term",
44-
"GrapeCity.gc-excelviewer",
45-
"redhat.vscode-xml",
46-
"streetsidesoftware.code-spell-checker",
47-
"timonwong.shellcheck",
48-
"mkhl.direnv",
49-
"github.vscode-github-actions",
50-
"Gruntfuggly.todo-tree",
51-
"ms-vscode.makefile-tools"
52-
],
53-
"settings": {
54-
"python.defaultInterpreterPath": "/workspaces/eps-devcontainers/.venv/bin/python",
55-
"python.analysis.autoSearchPaths": true,
56-
"python.analysis.extraPaths": [],
57-
"python.testing.unittestEnabled": false,
58-
"python.testing.pytestEnabled": true,
59-
"pylint.enabled": false,
60-
"python.linting.flake8Enabled": true,
61-
"python.linting.enabled": true,
62-
"editor.formatOnPaste": false,
63-
"editor.formatOnType": false,
64-
"editor.formatOnSave": true,
65-
"editor.formatOnSaveMode": "file",
66-
"cSpell.words": [
67-
"fhir",
68-
"Formik",
69-
"pino",
70-
"serialisation"
71-
],
72-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
11+
"mounts": [
12+
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
13+
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
14+
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
15+
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind"
16+
],
17+
"runArgs": [
18+
"--network=host"
19+
],
20+
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
21+
"postAttachCommand": "docker build -f https://raw.githubusercontent.com/NHSDigital/eps-workflow-quality-checks/refs/tags/v4.0.4/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && poetry run pre-commit install --install-hooks -f",
22+
"features": {
23+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
24+
"version": "latest",
25+
"moby": "true",
26+
"installDockerBuildx": "true"
7327
},
74-
"eslint.useFlatConfig": true,
75-
"eslint.format.enable": true
76-
}
77-
},
78-
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/eps-devcontainers; make install; direnv allow ."
79-
}
28+
"ghcr.io/devcontainers/features/github-cli:1": {}
29+
},
30+
"customizations": {
31+
"vscode": {
32+
"extensions": [
33+
"AmazonWebServices.aws-toolkit-vscode",
34+
"redhat.vscode-yaml",
35+
"ms-python.python",
36+
"ms-python.flake8",
37+
"eamodio.gitlens",
38+
"github.vscode-pull-request-github",
39+
"orta.vscode-jest",
40+
"42crunch.vscode-openapi",
41+
"mermade.openapi-lint",
42+
"christian-kohler.npm-intellisense",
43+
"dbaeumer.vscode-eslint",
44+
"lfm.vscode-makefile-term",
45+
"GrapeCity.gc-excelviewer",
46+
"redhat.vscode-xml",
47+
"streetsidesoftware.code-spell-checker",
48+
"timonwong.shellcheck",
49+
"mkhl.direnv",
50+
"github.vscode-github-actions",
51+
"Gruntfuggly.todo-tree",
52+
"ms-vscode.makefile-tools"
53+
],
54+
"settings": {
55+
"python.defaultInterpreterPath": "/workspaces/eps-devcontainers/.venv/bin/python",
56+
"python.analysis.autoSearchPaths": true,
57+
"python.analysis.extraPaths": [],
58+
"python.testing.unittestEnabled": false,
59+
"python.testing.pytestEnabled": true,
60+
"pylint.enabled": false,
61+
"python.linting.flake8Enabled": true,
62+
"python.linting.enabled": true, // required to format on save
63+
"editor.formatOnPaste": false, // required
64+
"editor.formatOnType": false, // required
65+
"editor.formatOnSave": true, // optional
66+
"editor.formatOnSaveMode": "file",
67+
"cSpell.words": ["fhir", "Formik", "pino", "serialisation"],
68+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
69+
70+
},
71+
"eslint.useFlatConfig": true,
72+
"eslint.format.enable": true
73+
}
74+
},
75+
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/eps-devcontainers; make install; direnv allow ."
76+
// "features": {},
77+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
78+
// "forwardPorts": [],
79+
// Use 'postCreateCommand' to run commands after the container is created.
80+
// "postCreateCommand": ""
81+
// Configure tool-specific properties.
82+
// "customizations": {},
83+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
84+
// "remoteUser": "root"
85+
}
86+

.github/workflows/build_all_images.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ name: build_all_images
1111
NO_CACHE:
1212
required: true
1313
type: boolean
14-
runtime_docker_image:
15-
type: string
16-
required: true
1714
env:
1815
BRANCH_NAME: '${{ github.event.pull_request.head.ref }}'
1916
jobs:
@@ -44,7 +41,6 @@ jobs:
4441
container_name: base
4542
base_folder: "."
4643
NO_CACHE: ${{ inputs.NO_CACHE }}
47-
runtime_docker_image: ${{ inputs.runtime_docker_image }}
4844
package_base_node_images:
4945
needs:
5046
- package_base_docker_image
@@ -60,7 +56,6 @@ jobs:
6056
container_name: ${{ matrix.container_name }}
6157
base_folder: "base_node"
6258
NO_CACHE: ${{ inputs.NO_CACHE }}
63-
runtime_docker_image: ${{ inputs.runtime_docker_image }}
6459
package_node_24_language_docker_images:
6560
needs:
6661
- package_base_docker_image
@@ -78,7 +73,6 @@ jobs:
7873
base_folder: "languages"
7974
NO_CACHE: ${{ inputs.NO_CACHE }}
8075
EXTRA_COMMON: "common_node_24"
81-
runtime_docker_image: ${{ inputs.runtime_docker_image }}
8276
package_project_docker_images:
8377
needs:
8478
- package_node_24_language_docker_images
@@ -94,4 +88,3 @@ jobs:
9488
container_name: ${{ matrix.container_name }}
9589
base_folder: "projects"
9690
NO_CACHE: ${{ inputs.NO_CACHE }}
97-
runtime_docker_image: ${{ inputs.runtime_docker_image }}

.github/workflows/build_multi_arch_image.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ name: Build and push docker image
2020
EXTRA_COMMON:
2121
required: false
2222
type: string
23-
runtime_docker_image:
24-
type: string
25-
required: true
2623

2724
jobs:
2825
build_and_push_image:
@@ -33,12 +30,6 @@ jobs:
3330
attestations: write
3431
id-token: write
3532
runs-on: '${{ matrix.runner }}'
36-
container:
37-
image: ghcr.io/nhsdigital/eps-devcontainers/${{ inputs.runtime_docker_image }}
38-
options: --user 1001:1001 --group-add 128
39-
defaults:
40-
run:
41-
shell: bash
4233

4334
strategy:
4435
fail-fast: false
@@ -49,9 +40,6 @@ jobs:
4940
- arch: arm64
5041
runner: ubuntu-22.04-arm
5142
steps:
52-
- name: copy .tool-versions
53-
run: |
54-
cp /home/vscode/.tool-versions "$HOME/.tool-versions"
5543
- name: Free Disk Space for Docker
5644
uses: endersonmenezes/free-disk-space@e6ed9b02e683a3b55ed0252f1ee469ce3b39a885
5745
with:

.github/workflows/ci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@ on:
44
branches: [main]
55

66
jobs:
7-
get_config_values:
8-
runs-on: ubuntu-22.04
9-
outputs:
10-
devcontainer_image_name: ${{ steps.load-config.outputs.DEVCONTAINER_IMAGE_NAME }}
11-
devcontainer_image_version: ${{ steps.load-config.outputs.DEVCONTAINER_IMAGE_VERSION }}
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
15-
- name: Load config value
16-
id: load-config
17-
run: |
18-
DEVCONTAINER_IMAGE_NAME=$(jq -r '.build.args.IMAGE_NAME' .devcontainer/devcontainer.json)
19-
DEVCONTAINER_IMAGE_VERSION=$(jq -r '.build.args.IMAGE_VERSION' .devcontainer/devcontainer.json)
20-
echo "DEVCONTAINER_IMAGE_NAME=$DEVCONTAINER_IMAGE_NAME" >> "$GITHUB_OUTPUT"
21-
echo "DEVCONTAINER_IMAGE_VERSION=$DEVCONTAINER_IMAGE_VERSION" >> "$GITHUB_OUTPUT"
227
get_asdf_version:
238
runs-on: ubuntu-22.04
249
outputs:
@@ -57,10 +42,8 @@ jobs:
5742
build_all_images:
5843
needs:
5944
- tag_release
60-
- get_config_values
6145
uses: ./.github/workflows/build_all_images.yml
6246
with:
6347
docker_tag: 'ci-${{ needs.tag_release.outputs.version_tag }}'
6448
tag_latest: false
6549
NO_CACHE: false
66-
runtime_docker_image: "${{ needs.get_config_values.outputs.devcontainer_image_name }}:githubactions-${{ needs.get_config_values.outputs.devcontainer_image_version }}"

.github/workflows/pull_request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ jobs:
109109
docker_tag: 'pr-${{ needs.get_issue_number.outputs.issue_number }}-${{ needs.get_commit_id.outputs.sha_short }}'
110110
tag_latest: false
111111
NO_CACHE: false
112-
runtime_docker_image: "${{ needs.get_config_values.outputs.devcontainer_image_name }}:githubactions-${{ needs.get_config_values.outputs.devcontainer_image_version }}"

0 commit comments

Comments
 (0)