Skip to content

Instantly share code, notes, and snippets.

@Lamarcke
Created July 12, 2023 23:21
Show Gist options
  • Save Lamarcke/54a26ccc59819b5bf5f506e8f0bc060c to your computer and use it in GitHub Desktop.
Save Lamarcke/54a26ccc59819b5bf5f506e8f0bc060c to your computer and use it in GitHub Desktop.
Create Docker Image on Push
name: Docker Build
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/1randomdev/mailspring-api
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment