From db24d29922710a3233ff733cb8a8701e9d2ceada Mon Sep 17 00:00:00 2001 From: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> Date: Wed, 8 Oct 2025 07:51:06 -0500 Subject: [PATCH] chore: Add GitHub Actions workflow for Docker build --- .github/workflows/build.yml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2fb9f18 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,66 @@ +name: Build Docker Image + +on: + push: + branches: [main] + tags: ["v*", "*.*.*"] + pull_request: + branches: [main] + workflow_dispatch: {} + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + IMAGE_NAME: mkcertweb + +jobs: + build-and-push: + name: Build and Push Image + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=sha + type=ref,event=tag + labels: | + org.opencontainers.image.source=${{ github.repository }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max