This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Caddy Docker Image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-amd64: | |
runs-on: ubuntu-24.04 | |
outputs: | |
digest: ${{ steps.build.outputs.digest }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image for amd64 | |
id: build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/skyblaster/caddy:amd64 | |
build-arm64: | |
runs-on: ubuntu-24.04-arm | |
outputs: | |
digest: ${{ steps.build.outputs.digest }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image for arm64 | |
id: build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/arm64 | |
push: true | |
tags: ghcr.io/skyblaster/caddy:arm64 | |
push_manifest: | |
needs: [build-amd64, build-arm64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Multi-Arch Manifest | |
uses: int128/docker-manifest-create-action@v2 | |
with: | |
tags: ghcr.io/skyblaster/caddy:latest | |
sources: | | |
ghcr.io/skyblaster/caddy:amd64@${{ needs.build-amd64.outputs.digest }} | |
ghcr.io/skyblaster/caddy:arm64@${{ needs.build-arm64.outputs.digest }} |