Skip to content

Commit 844be08

Browse files
committed
update readme
1 parent 4a44268 commit 844be08

2 files changed

Lines changed: 42 additions & 10 deletions

File tree

.github/workflows/build_multi_arch_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
if [ -f "$common" ]; then sed -n '2,$p' "$common" >> "$combined"; fi
6767
if [ -f "$specific" ]; then sed -n '2,$p' "$specific" >> "$combined"; fi
6868
echo "Combined trivy ignore file created at $combined"
69-
cat "$combined"
7069
7170
env:
7271
ARCHITECTURE: '${{ matrix.arch }}'
@@ -78,6 +77,7 @@ jobs:
7877
with:
7978
name: "trivyigonre-${{ inputs.container_name }}-${{ matrix.arch }}"
8079
path: src/${{ inputs.container_name }}/.trivyignore_combined.yaml
80+
include-hidden-files: true
8181
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
8282
name: Upload docker images
8383
with:

README.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ EPS DEV CONTAINERS
22
==================
33

44
# Introduction
5-
This repo contains code to build a vscode devcontainer that is used as a base image for all EPS projects.
5+
This repo contains code to build a vscode devcontainers that can be used as a base image for all EPS projects.
66
Images are build for amd64 and arm64 and a manifest file created that can be pulled for both architectures.
77
Images are based on mcr.microsoft.com/devcontainers/base:ubuntu-22.04
88
Images contain
@@ -25,31 +25,63 @@ asdf install and setup for these so they are available globally as vscode user
2525
- trivy
2626

2727
Install asdf plugins for all tools we use
28-
Install asdf versions of node, python, java, terraform, golang used by all EPS projects to speed up initial build of local dev container
2928
Install and setup git-secrets
3029

3130
# Project structure
32-
The dev container is defined in src/base/.devcontainer folder. This folder contains a Dockerfile and a devcontainer.json file which is used to build the container.
31+
## base container
32+
The base dev container is defined in src/base/.devcontainer folder. This folder contains a Dockerfile and a devcontainer.json file which is used to build the container.
3333
As part of the dockerfile, there are scripts in the scripts folder that run as root and vscode user that setup and install various programs.
3434

3535
The dev container is built using https://github.com/devcontainers/cli
3636

37-
The script `scripts/generate_language_version_files.sh` gets the version of node, python, java and terraform from all EPS repositories. It uses the list of repos from https://github.com/NHSDigital/eps-repo-status/blob/main/repos.json to find all EPS repos.
37+
## common files
38+
There are some common files under src/common. These include
39+
- a Dockerfile used to build specific containers that installs poetry after python has been installed
40+
- a .trivyignore file that contains trivy suppressions in the base image
41+
42+
## specific containers
43+
There are specific containers in src/<specific> - eg src/base/node_24_python_3_14
44+
These have a .devcontainer/devcontainer.json file used to built the image
45+
These use the base container as a base and then install specific versions of tools using devcontainer features, or a customised Dockerfile
46+
If there are specific vulnerabilities from these tools, then these should be added to the .trivyignore file in the folder
3847

3948
# Build process
40-
Docker images are built for each pull request, and on merges to main
49+
Docker images are built for each pull request, and on merges to main.
50+
Docker images are built for amd64 and arm64 architecture, and a combined manifest is created and pushed as part of the build.
51+
52+
The base image is built first, and then all other images are built
4153

4254
Docker images are scanned for vulnerabilities using trivy as part of a build step, and the build fails if vulnerabilities are found not in .trivyignore file.
43-
44-
On merges to main, a new release is created and the images are pushed to github. The images are tagged with `latest` and the version of the release.
55+
56+
For pull requests, an image is pushed with tag `pr-<pull-request-id>-<short commit sha>`
57+
On merges to main, a new release is created, and images are tagged with `latest` and the version of the release.
4558

4659
# Local testing
4760
For local testing, you can run
4861
```
49-
ARCHITECTURE=amd64 make build-base-image
62+
CONTAINER_NAME=base BASE_VERSION=latest make build-image
5063
```
5164
to build a local image, and then
5265
```
53-
make scan-base-image
66+
CONTAINER_NAME=base BASE_VERSION=latest make scan-image
5467
```
5568
to scan for vulnerabilities
69+
70+
# Using the images
71+
In each eps project, you can put this in the devcontainer Dockerfile. You should not need to add any features.
72+
```
73+
FROM ghcr.io/nhsdigital/eps-devcontainers/node_24_python_3_13:<version>
74+
75+
USER root
76+
# specify DOCKER_GID to force container docker group id to match host
77+
RUN if [ -n "${DOCKER_GID}" ]; then \
78+
if ! getent group docker; then \
79+
groupadd -g ${DOCKER_GID} docker; \
80+
else \
81+
groupmod -g ${DOCKER_GID} docker; \
82+
fi && \
83+
usermod -aG docker vscode; \
84+
fi
85+
86+
USER vscode
87+
```

0 commit comments

Comments
 (0)