You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-9Lines changed: 41 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ EPS DEV CONTAINERS
2
2
==================
3
3
4
4
# 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.
6
6
Images are build for amd64 and arm64 and a manifest file created that can be pulled for both architectures.
7
7
Images are based on mcr.microsoft.com/devcontainers/base:ubuntu-22.04
8
8
Images contain
@@ -25,31 +25,63 @@ asdf install and setup for these so they are available globally as vscode user
25
25
- trivy
26
26
27
27
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
29
28
Install and setup git-secrets
30
29
31
30
# 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.
33
33
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.
34
34
35
35
The dev container is built using https://github.com/devcontainers/cli
36
36
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
38
47
39
48
# 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
41
53
42
54
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.
45
58
46
59
# Local testing
47
60
For local testing, you can run
48
61
```
49
-
ARCHITECTURE=amd64 make build-base-image
62
+
CONTAINER_NAME=base BASE_VERSION=latest make build-image
50
63
```
51
64
to build a local image, and then
52
65
```
53
-
make scan-base-image
66
+
CONTAINER_NAME=base BASE_VERSION=latest make scan-image
54
67
```
55
68
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
0 commit comments