Skip to content

Commit 75a9442

Browse files
change to devcontainer ci
1 parent 56a9f62 commit 75a9442

File tree

2 files changed

+60
-35
lines changed

2 files changed

+60
-35
lines changed

.github/workflows/cicd.yaml

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ jobs:
2424
repository: nhs-notify-devcontainers
2525
path: src/devcontainers/base
2626
readme: README.md
27+
makefile_dir: ./src/devcontainers/base
2728
context: ./src/devcontainers/base/src/.devcontainer
2829
dockerfile: Dockerfile
2930
registry: ghcr.io
3031
image: nhsdigital/nhs-notify-devcontainer-base
3132
title: NHS Notifiy Devcontainer Base Image
3233
description: Base development container for NHS Notify projects
3334
vendor: NHS England
35+
subFolder: ./src/devcontainers/base/src
36+
runCmd: /welcome.sh
3437

3538
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
3639
permissions:
@@ -49,40 +52,58 @@ jobs:
4952
registry: ${{ matrix.registry }}
5053
username: ${{ github.actor }}
5154
password: ${{ secrets.GITHUB_TOKEN }}
52-
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
53-
- name: Extract metadata (tags, labels) for Docker
54-
id: meta
55-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
56-
with:
57-
images: ${{ matrix.registry }}/${{ matrix.image }}
58-
flavor: |
59-
latest=auto
60-
tags: |
61-
type=raw,value=latest,enable={{is_default_branch}}
62-
labels: |
63-
org.opencontainers.image.title= ${{ matrix.title }}
64-
org.opencontainers.image.description=${{ matrix.description }}
65-
org.opencontainers.image.vendor=${{ matrix.vendor }}
66-
org.opencontainers.image.url=${{ matrix.server }}/${{ matrix.org }}/${{ matrix.repository }}/blob/main/${{ matrix.path }}/${{ matrix.readme }}
67-
org.opencontainers.image.source=${{ matrix.server }}/${{ matrix.org }}/${{ matrix.repository }}/tree/main/${{ matrix.path }}
68-
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
69-
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
70-
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
71-
- name: Build and push Docker image
72-
id: push
73-
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
55+
56+
- name: Pre-build dev container image
57+
uses: devcontainers/[email protected]
7458
with:
75-
context: ${{ matrix.context }}
76-
file: ${{ matrix.context }}/${{ matrix.dockerfile }}
77-
push: true
78-
tags: ${{ steps.meta.outputs.tags }}
79-
labels: ${{ steps.meta.outputs.labels }}
59+
imageName: ${{ matrix.registry }}/${{ matrix.image }}
60+
push: always
61+
subFolder: ${{ matrix.subFolder }}
62+
runCmd: ${{ matrix.runCmd }}
63+
64+
# - uses: actions/setup-node@v6
65+
# with:
66+
# node-version: 24
67+
68+
# # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
69+
# - name: Extract metadata (tags, labels) for Docker
70+
# id: meta
71+
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
72+
# with:
73+
# images: ${{ matrix.registry }}/${{ matrix.image }}
74+
# flavor: |
75+
# latest=auto
76+
# tags: |
77+
# type=raw,value=latest,enable={{is_default_branch}}
78+
# labels: |
79+
# org.opencontainers.image.title= ${{ matrix.title }}
80+
# org.opencontainers.image.description=${{ matrix.description }}
81+
# org.opencontainers.image.vendor=${{ matrix.vendor }}
82+
# org.opencontainers.image.url=${{ matrix.server }}/${{ matrix.org }}/${{ matrix.repository }}/blob/main/${{ matrix.path }}/${{ matrix.readme }}
83+
# org.opencontainers.image.source=${{ matrix.server }}/${{ matrix.org }}/${{ matrix.repository }}/tree/main/${{ matrix.path }}
84+
# # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
85+
# # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
86+
# # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
87+
88+
89+
# - run: make build
90+
# working-directory: ${{ matrix.makefile_dir }}
91+
92+
# - name: Build and push Docker image
93+
# id: push
94+
# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
95+
# with:
96+
# context: ${{ matrix.context }}
97+
# file: ${{ matrix.context }}/${{ matrix.dockerfile }}
98+
# push: true
99+
# tags: ${{ steps.meta.outputs.tags }}
100+
# labels: ${{ steps.meta.outputs.labels }}
80101

81-
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
82-
- name: Generate artifact attestation
83-
uses: actions/attest-build-provenance@v3
84-
with:
85-
subject-name: ${{ matrix.registry }}/${{ matrix.image }}
86-
subject-digest: ${{ steps.push.outputs.digest }}
87-
push-to-registry: true
102+
# # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
103+
# - name: Generate artifact attestation
104+
# uses: actions/attest-build-provenance@v3
105+
# with:
106+
# subject-name: ${{ matrix.registry }}/${{ matrix.image }}
107+
# subject-digest: ${{ steps.push.outputs.digest }}
108+
# push-to-registry: true
88109

src/devcontainers/base/src/.devcontainer/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
2-
LABEL org.opencontainers.image.source=https://github.com/NHSDigital/nhs-notify-devcontainers/src/base/src
2+
LABEL org.opencontainers.image.source=https://github.com/NHSDigital/nhs-notify-devcontainers/tree/main/src/devcontainers/base
3+
LABEL org.opencontainers.image.url=https://github.com/NHSDigital/nhs-notify-devcontainers/blob/main/src/devcontainers/base/README.md
34
LABEL org.opencontainers.image.description="Base Dev Container for NHS Digital Notify development environments"
5+
LABEL org.opencontainers.image.vendor="NHS England"
46
LABEL org.opencontainers.image.licenses=MIT
7+
LABEL org.opencontainers.image.title="NHS Digital Notify Base Dev Container"
8+
LABEL org.opencontainers.image.description="Base Dev Container for NHS Digital Notify development environments"
59
WORKDIR /setup
610
COPY scripts ./scripts
711
WORKDIR /setup/scripts

0 commit comments

Comments
 (0)