Skip to content

Commit 9236a42

Browse files
committed
build more images
1 parent 57f26d5 commit 9236a42

File tree

6 files changed

+41
-16
lines changed

6 files changed

+41
-16
lines changed

.github/workflows/build_multi_arch_image.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and push docker image
22
'on':
33
workflow_call:
44
inputs:
5-
publish_image:
5+
tag_latest:
66
required: true
77
type: boolean
88
docker_tag:
@@ -63,6 +63,7 @@ jobs:
6363
ARCHITECTURE: '${{ matrix.arch }}'
6464
DOCKER_TAG: '${{ inputs.docker_tag }}'
6565
CONTAINER_NAME: '${{ inputs.container_name }}'
66+
BASE_VERSION: ${{ inputs.docker_tag}}
6667
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
6768
name: Upload docker images
6869
with:
@@ -114,7 +115,6 @@ jobs:
114115
publish_image:
115116
needs: build_image
116117
runs-on: ubuntu-22.04
117-
if: ${{ inputs.publish_image }}
118118
permissions:
119119
contents: read
120120
packages: write
@@ -150,33 +150,44 @@ jobs:
150150
username: ${{github.actor}}
151151
password: ${{secrets.GITHUB_TOKEN}}
152152

153-
154-
- name: Load and push multi-arch image
153+
- name: Load and push multi-arch tagged image
155154
run: |
156155
echo "loading images"
157156
docker load -i "eps-devcontainer-${CONTAINER_NAME}-${DOCKER_TAG}-amd64.img"
158157
docker load -i "eps-devcontainer-${CONTAINER_NAME}-${DOCKER_TAG}-arm64.img"
159158
159+
echo "pushing images"
160+
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64"
161+
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64"
162+
163+
echo "creating manifest"
164+
docker manifest create "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}" \
165+
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64" \
166+
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64"
167+
168+
echo "pushing manifest"
169+
docker manifest push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}"
170+
env:
171+
DOCKER_TAG: ${{ inputs.docker_tag }}
172+
CONTAINER_NAME: '${{ inputs.container_name }}'
173+
174+
- name: Load and push multi-arch latest image
175+
if: ${{ inputs.tag_latest }}
176+
run: |
160177
echo "Tagging latest images"
161178
docker tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64" "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-amd64"
162179
docker tag "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64" "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-arm64"
163180
164181
echo "pushing images"
165-
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64"
166-
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64"
167182
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-amd64"
168183
docker push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-arm64"
169184
170185
echo "creating manifest"
171-
docker manifest create "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}" \
172-
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-amd64" \
173-
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}-arm64"
174186
docker manifest create "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest" \
175187
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-amd64" \
176188
--amend "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest-arm64"
177189
178190
echo "pushing manifest"
179-
docker manifest push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:${DOCKER_TAG}"
180191
docker manifest push "ghcr.io/nhsdigital/eps-devcontainers/${CONTAINER_NAME}:latest"
181192
env:
182193
DOCKER_TAG: ${{ inputs.docker_tag }}

.github/workflows/pull_request.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,22 @@ jobs:
8484
# echo "commit_id=${{ github.sha }}" >> "$GITHUB_ENV"
8585
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
8686
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
87-
package_docker_image:
87+
package_base_docker_image:
8888
uses: ./.github/workflows/build_multi_arch_image.yml
8989
needs:
9090
- get_issue_number
9191
- get_commit_id
9292
with:
93-
publish_image: true
93+
tag_latest: false
9494
docker_tag: 'pr${{ needs.get_issue_number.outputs.issue_number }}-${{ needs.get_commit_id.outputs.sha_short }}'
9595
container_name: base
96+
package_node_24_python_3_14_docker_image:
97+
uses: ./.github/workflows/build_multi_arch_image.yml
98+
needs:
99+
- get_issue_number
100+
- get_commit_id
101+
- package_base_docker_image
102+
with:
103+
tag_latest: false
104+
docker_tag: 'pr${{ needs.get_issue_number.outputs.issue_number }}-${{ needs.get_commit_id.outputs.sha_short }}'
105+
container_name: node_24_python_3_14

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ jobs:
4343
needs: tag_release
4444
uses: ./.github/workflows/build_multi_arch_image.yml
4545
with:
46-
publish_image: true
46+
tag_latest: true
4747
docker_tag: '${{ needs.tag_release.outputs.version_tag }}'
4848
container_name: base

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install-node:
1717
install-hooks: install-python
1818
poetry run pre-commit install --install-hooks --overwrite
1919

20-
build-image: guard-CONTAINER_NAME
20+
build-image: guard-CONTAINER_NAME guard-BASE_VERSION
2121
npx devcontainer build \
2222
--workspace-folder ./src/$${CONTAINER_NAME}/ \
2323
--push false \

src/common/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM ghcr.io/nhsdigital/eps-devcontainers/base:latest
1+
ARG BASE_VERSION=latest
2+
3+
FROM ghcr.io/nhsdigital/eps-devcontainers/base:${BASE_VERSION}
24

35
# common Dockerfile used to setup poetry after installing python
46

src/node_24_python_3.14/.devcontainer/devcontainer.json renamed to src/node_24_python_3_14/.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"build": {
77
"dockerfile": "../../common/Dockerfile",
8-
"args": {}
8+
"args": {
9+
"BASE_VERSION": "${localEnv:BASE_VERSION}"
10+
}
911
},
1012
"runArgs": [
1113
"--network=host"

0 commit comments

Comments
 (0)