Build time optimizations #44
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: Deploy Images to GHCR | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
paths-ignore: | |
- '**.md' | |
- '.github/workflows/publish.yaml' | |
workflow_dispatch: | |
jobs: | |
push-store-image: | |
runs-on: ubuntu-latest | |
environment: production | |
defaults: | |
run: | |
working-directory: '.' | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@main | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
mrrubberducky/qor-caddy | |
ghcr.io/rubberverse/qor-caddy | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
# Cross-platform compilation setup | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Login to GitHub Container Registry - ghcr.io | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
# Login to Docker Hub - hub.docker.com | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build and push to registries | |
- name: Build and push | |
uses: docker/[email protected] | |
with: | |
context: ./ | |
file: Caddy.Dockerfile | |
platforms: linux/arm64,linux/amd64,linux/s390x,linux/386 | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=gha . | |
build-args: BUILDKIT_MULTIPLATFORM=1 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |