Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 61 additions & 32 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
name: CI/CD

on:
push:
branches: [master]
pull_request:
workflow_dispatch:
schedule:
- cron: '23 5 * * 1'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
checks:
runs-on: ubuntu-24.04
outputs:
tags: ${{ steps.tags.outputs.tags }}
steps:
- uses: actions/checkout@v7
- name: Check generated contexts
run: |
docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template
git diff --exit-code
- id: tags
run: echo "tags=$(jq -c '[.builds[].name]' fwd-template.json)" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: checks
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
version: [php, proxy, static]

platform:
- {arch: amd64, runner: ubuntu-24.04}
steps:
- name: Checkout code
uses: actions/checkout@v7.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.2.0

- name: Build
run: |
docker buildx build \
--pull --no-cache \
--platform linux/amd64 \
--output type=docker \
--tag kooldev/nginx:${{ matrix.version }} \
${{ matrix.version }}

- name: Tests
run: bash tests/smoke.sh "${{ matrix.version }}" "kooldev/nginx:${{ matrix.version }}"

- name: Scan image
- uses: actions/checkout@v7
- uses: kool-dev/action/image-build@6a6d04e8d1e1c66afc178e32c7d77d76169c7717
with:
arch: ${{ matrix.platform.arch }}
- name: Build fresh image
id: image
uses: docker/build-push-action@v7
with:
context: ${{ matrix.version }}
platforms: linux/${{ matrix.platform.arch }}
pull: true
no-cache: true
load: true
provenance: false
tags: kooldev/nginx:${{ matrix.version }}
- name: Smoke tests
env:
VARIANT: ${{ matrix.version }}
IMAGE: ${{ steps.image.outputs.imageid }}
run: bash tests/smoke.sh "$VARIANT" "$IMAGE"
- name: Scan tested image
uses: anchore/scan-action@8576240a41341d866dbd7ebc72cd9fc0ef023f54 # v7.4.2
with:
image: kooldev/nginx:${{ matrix.version }}
Expand All @@ -47,22 +63,35 @@ jobs:
only-fixed: false
output-format: json
output-file: grype-${{ matrix.version }}.json

- name: Retain vulnerability report
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: grype-${{ matrix.version }}
path: grype-${{ matrix.version }}.json
if-no-files-found: warn

- name: Login to DockerHub
uses: docker/login-action@v4.4.0
- uses: kool-dev/action/image-stage@6a6d04e8d1e1c66afc178e32c7d77d76169c7717
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-nginx'
with:
canonical-repository: kool-dev/docker-nginx
default-branch: master
repository: kooldev/nginx
arch: ${{ matrix.platform.arch }}
group: ${{ matrix.version }}
images: '[{"tag":"${{ matrix.version }}","id":"${{ steps.image.outputs.imageid }}"}]'
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
publish:
needs: [checks, build]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-nginx'
runs-on: ubuntu-24.04
steps:
- uses: kool-dev/action/image-publish@6a6d04e8d1e1c66afc178e32c7d77d76169c7717
with:
canonical-repository: kool-dev/docker-nginx
default-branch: master
repository: kooldev/nginx
tags: ${{ needs.checks.outputs.tags }}
architectures: '["amd64"]'
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to DockerHub
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-nginx'
run: docker push kooldev/nginx:${{ matrix.version }}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ CI builds all three variants for **linux/amd64**. ARM is not supported by the
bundled dockerize binary. Weekly Monday rebuilds pull the latest `nginx:alpine`
and refresh Alpine packages without reusing build layers.

CI uses [shared Bash/`jq` actions](https://github.com/kool-dev/action/blob/master/image-ci.md),
pinned in the workflow. Builds, HTTP tests and Grype scans stay here. After all
three jobs pass, one publisher promotes the tested/scanned digests as amd64-only
indexes. See the shared release rules for publication guards and retry behavior.

Run the same configuration and HTTP checks locally after building an image:

```sh
Expand Down