Files
cloud-configuration/.github/workflows/create-nginx.yaml
T

63 lines
1.7 KiB
YAML

name: Create Nginx image
on:
workflow_call:
push:
branches:
- main
paths:
- 'docker/**/nginx/certificates-available/**'
- 'docker/**/nginx/Dockerfile'
- 'docker/**/nginx/entrypoint.sh'
- 'docker/**/nginx/nginx.conf'
env:
REGISTRY: ghcr.io
IMAGE_NAME: 2martens/docker-nginx
jobs:
create-nginx:
name: Build Nginx image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
env: [ test ]
environment: ${{ matrix.env }}
steps:
- uses: actions/checkout@v4
- name: Perform docker login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ matrix.env }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push Nginx image to GHCR
id: push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: docker/${{ matrix.env }}/nginx
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Attest
uses: actions/attest-build-provenance@v2
id: attest
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}