Skip to content

Commit 733ec9e

Browse files
committed
use published dev container
1 parent 997a194 commit 733ec9e

6 files changed

Lines changed: 27 additions & 154 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,14 @@
1-
FROM mcr.microsoft.com/devcontainers/base:ubuntu
2-
3-
# provide DOCKER_GID via build args if you need to force group id to match host
4-
ARG DOCKER_GID
1+
FROM ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_14:v1.0.0
52

3+
USER root
64
# specify DOCKER_GID to force container docker group id to match host
75
RUN if [ -n "${DOCKER_GID}" ]; then \
8-
if ! getent group docker; then \
9-
groupadd -g ${DOCKER_GID} docker; \
10-
else \
11-
groupmod -g ${DOCKER_GID} docker; \
12-
fi && \
13-
usermod -aG docker vscode; \
6+
if ! getent group docker; then \
7+
groupadd -g ${DOCKER_GID} docker; \
8+
else \
9+
groupmod -g ${DOCKER_GID} docker; \
10+
fi && \
11+
usermod -aG docker vscode; \
1412
fi
1513

16-
# Anticipate and resolve potential permission issues with apt
17-
RUN mkdir -p /tmp && chmod 1777 /tmp
18-
19-
RUN apt-get update \
20-
&& export DEBIAN_FRONTEND=noninteractive \
21-
&& apt-get -y dist-upgrade \
22-
&& apt-get -y install --no-install-recommends htop vim curl git build-essential \
23-
libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \
24-
zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \
25-
jq apt-transport-https ca-certificates gnupg-agent \
26-
software-properties-common bash-completion python3-pip make libbz2-dev \
27-
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
28-
xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev
29-
3014
USER vscode
31-
32-
# Install ASDF
33-
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 && \
34-
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc && \
35-
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
36-
37-
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin:/workspaces/eps-common-workflows/.venv/bin"
38-
39-
# Install ASDF plugins#
40-
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
41-
asdf plugin add actionlint && \
42-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
43-
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
44-
asdf plugin add python
45-
46-
WORKDIR /workspaces/eps-common-workflows
47-
48-
ADD .tool-versions /workspaces/eps-common-workflows/.tool-versions
49-
ADD .tool-versions /home/vscode/.tool-versions
50-
51-
RUN asdf install python && \
52-
asdf install && \
53-
asdf reshim nodejs

.devcontainer/devcontainer.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,14 @@
1414
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
1515
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
1616
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
17-
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind"
17+
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind",
18+
"source=${env:HOME}${env:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,type=bind"
1819
],
1920
"containerUser": "vscode",
2021
"remoteEnv": {
2122
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
2223
},
23-
"postAttachCommand": "docker build -f /workspaces/eps-common-workflows/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && pre-commit install --install-hooks -f",
24-
"features": {
25-
"ghcr.io/devcontainers/features/github-cli:1": {},
26-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
27-
"version": "latest",
28-
"moby": "true",
29-
"installDockerBuildx": "true"
30-
}
31-
},
24+
"features": {},
3225
"customizations": {
3326
"vscode": {
3427
"extensions": [

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
needs: [get_asdf_version]
3939
with:
4040
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
41+
runtime_docker_image: "ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_14:v1.0.0"
4142
secrets:
4243
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4344
tag_release:

.github/workflows/quality-checks.yml

Lines changed: 11 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ on:
3333
description: comma separated list of docker image references to scan when docker scanning is enabled.
3434
default: ""
3535
required: false
36+
runtime_docker_image:
37+
type: string
38+
required: true
3639

3740
jobs:
3841
quality_checks:
3942
runs-on: ubuntu-22.04
43+
container:
44+
image: ${{ inputs.runtime_docker_image }}
4045
steps:
4146
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
4247
if: ${{ inputs.install_java }}
@@ -50,70 +55,10 @@ jobs:
5055
with:
5156
ref: ${{ env.BRANCH_NAME }}
5257
fetch-depth: 0
53-
54-
# Must be done before anything installs, or it will check dependencies for secrets too.
55-
- name: Ensure .gitallowed exists, for secret scanning
56-
run: |
57-
if [ ! -f ".gitallowed" ]; then
58-
echo "Creating empty .gitallowed file"
59-
touch .gitallowed
60-
fi
61-
echo "./nhsd-rules-deny.txt:10" >> .gitallowed
62-
echo "Allowing the following regex patterns:"
63-
cat .gitallowed
64-
65-
- name: Install git-secrets
66-
run: |
67-
sudo apt-get update
68-
sudo apt-get install -y git curl
69-
git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets
70-
cd /tmp/git-secrets
71-
sudo make install
72-
73-
- name: Download regex patterns
74-
run: |
75-
curl -L https://raw.githubusercontent.com/NHSDigital/software-engineering-quality-framework/main/tools/nhsd-git-secrets/nhsd-rules-deny.txt -o nhsd-rules-deny.txt
76-
77-
- name: Configure git-secrets
78-
run: |
79-
git-secrets --register-aws
80-
git-secrets --add-provider -- cat nhsd-rules-deny.txt
81-
8258
- name: Run secrets scan
8359
run: |
8460
git-secrets --scan-history .
8561
86-
# using git commit sha for version of action to ensure we have stable version
87-
- &install_asdf
88-
name: Install asdf
89-
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
90-
with:
91-
asdf_version: ${{ inputs.asdfVersion }}
92-
93-
- &cache_asdf
94-
name: Cache asdf
95-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
96-
with:
97-
path: ~/.asdf
98-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }}
99-
100-
- &install_asdf_deps
101-
name: Install asdf dependencies in .tool-versions
102-
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
103-
with:
104-
asdf_version: ${{ inputs.asdfVersion }}
105-
env:
106-
PYTHON_CONFIGURE_OPTS: --enable-shared
107-
108-
- &reinstall_poetry
109-
name: Reinstall poetry
110-
if: ${{ inputs.reinstall_poetry }}
111-
run: |
112-
poetry_tool_version=$(cat .tool-versions | grep poetry)
113-
poetry_version=${poetry_tool_version//"poetry "}
114-
asdf uninstall poetry "$poetry_version"
115-
asdf install poetry
116-
11762
- &setup_npmrc
11863
name: Setting up .npmrc
11964
env:
@@ -356,6 +301,8 @@ jobs:
356301
outputs:
357302
docker_images: ${{ steps.normalized_docker_images.outputs.images }}
358303
runs-on: ubuntu-22.04
304+
container:
305+
image: ${{ inputs.runtime_docker_image }}
359306
steps:
360307
- name: Checkout code
361308
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
@@ -420,6 +367,8 @@ jobs:
420367
421368
docker_vulnerability_scan:
422369
runs-on: ubuntu-22.04
370+
container:
371+
image: ghcr.io/nhsdigital/eps-devcontainers/fhir_facade_api:v1.0.0
423372
needs: get_docker_images_to_scan
424373
if: ${{ inputs.run_docker_scan == true }}
425374
strategy:
@@ -431,36 +380,6 @@ jobs:
431380
with:
432381
ref: ${{ env.BRANCH_NAME }}
433382
fetch-depth: 0
434-
# using git commit sha for version of action to ensure we have stable version
435-
- name: Install asdf
436-
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47
437-
with:
438-
asdf_version: ${{ inputs.asdfVersion }}
439-
440-
- name: Cache asdf
441-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
442-
with:
443-
path: |
444-
~/.asdf
445-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }}
446-
restore-keys: |
447-
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ inputs.asdfVersion }}
448-
449-
- name: Install asdf dependencies in .tool-versions
450-
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
451-
with:
452-
asdf_version: ${{ inputs.asdfVersion }}
453-
env:
454-
PYTHON_CONFIGURE_OPTS: --enable-shared
455-
456-
- name: Reinstall poetry
457-
if: ${{ inputs.reinstall_poetry }}
458-
run: |
459-
poetry_tool_version=$(cat .tool-versions | grep poetry)
460-
poetry_version=${poetry_tool_version//"poetry "}
461-
asdf uninstall poetry "$poetry_version"
462-
asdf install poetry
463-
464383
- name: Setting up .npmrc
465384
env:
466385
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -508,12 +427,10 @@ jobs:
508427
509428
IaC-validation:
510429
runs-on: ubuntu-22.04
430+
container:
431+
image: ${{ inputs.runtime_docker_image }}
511432
steps:
512433
- *checkout
513-
- *install_asdf
514-
- *cache_asdf
515-
- *install_asdf_deps
516-
- *reinstall_poetry
517434

518435
- name: Check for SAM templates
519436
id: check_sam_templates

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
uses: ./.github/workflows/quality-checks.yml
3131
with:
3232
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
33+
runtime_docker_image: "ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_14:v1.0.0"
3334
secrets:
3435
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3536
tag_release:

.tool-versions

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
nodejs 24.12.0
1+
nodejs 24.13.0
22
actionlint 1.7.10
33
shellcheck 0.11.0
4-
python 3.14.2
5-
poetry 2.2.1
4+
python 3.14.3
5+
poetry 2.3.2

0 commit comments

Comments
 (0)