From b1176ac3c2bc56a1d9740594324d86ba62355da4 Mon Sep 17 00:00:00 2001 From: Stephen Walsh <868017+stphnwlsh@users.noreply.github.com> Date: Wed, 2 Dec 2026 13:26:31 +0000 Subject: [PATCH] Fix the monthly release: upgrade OS packages in the image and check out before downloading the package --- .agents/skills/docker-and-compose/SKILL.md | 3 ++- .github/workflows/build-pipeline.yml | 21 +++++++++++---------- Dockerfile | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.agents/skills/docker-and-compose/SKILL.md b/.agents/skills/docker-and-compose/SKILL.md index 48b87c1..9bcda42 100644 --- a/.agents/skills/docker-and-compose/SKILL.md +++ b/.agents/skills/docker-and-compose/SKILL.md @@ -46,7 +46,8 @@ Every port published on the developer's machine, by the compose file or by `laun 2. Anything the app writes goes under `/app/data`, the only folder the app user can write to. 3. Pin every image in compose to a version, and bump them with the monthly package update (`packages-and-dependencies`). 4. Change base images through the `ARG`s at the top, not inside a `FROM`. -5. Test locally with `docker compose up -d --build`, then hit `/health/ready` and the API reference. +5. Keep the OS upgrade at the top of the `run` stage (`apk upgrade` on Alpine, `dnf upgrade` on the Lambda image). Base images lag behind OS security fixes, and the container scan fails on a HIGH finding that already has a fix. +6. Test locally with `docker compose up -d --build`, then hit `/health/ready` and the API reference. ## Don't diff --git a/.github/workflows/build-pipeline.yml b/.github/workflows/build-pipeline.yml index 0f5d9fe..6b69833 100644 --- a/.github/workflows/build-pipeline.yml +++ b/.github/workflows/build-pipeline.yml @@ -565,6 +565,17 @@ jobs: id-token: write steps: + # Check out first: checkout empties the workspace, so anything downloaded before it is lost. + - name: Checkout + id: checkout + uses: actions/checkout@v7 + + - name: Setup .NET + id: setup + uses: actions/setup-dotnet@v6 + with: + dotnet-version: '10.0.x' + - name: Download Template id: download-template uses: actions/download-artifact@v8 @@ -600,16 +611,6 @@ jobs: DRY_RUN: ${{ needs.release.outputs.dry-run == 'true' && 'yes' || '' }} shell: bash - - name: Checkout - id: checkout - uses: actions/checkout@v7 - - - name: Setup .NET - id: setup - uses: actions/setup-dotnet@v6 - with: - dotnet-version: '10.0.x' - - name: Publish API id: publish-api run: dotnet publish ./src/Presentation/Presentation.csproj --configuration Release --output sbom-source --no-self-contained diff --git a/Dockerfile b/Dockerfile index 797715c..3ae85c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,11 @@ RUN dotnet publish ./src/**/Presentation.csproj --no-restore -c Release -v quiet # Runtime Image FROM ${BASE_IMAGE_REPO}/${BASE_IMAGE_RUNTIME}:${BASE_IMAGE_RUNTIME_TAG} AS run + +# Apply Alpine security fixes published since the base image was built, so the +# container scan isn't waiting on the next base image release. +RUN apk upgrade --no-cache + WORKDIR /app ENV ASPNETCORE_HTTP_PORTS=7320 EXPOSE 7320