Skip to content

Instantly share code, notes, and snippets.

@a5r0n
Created August 13, 2022 23:03
Show Gist options
  • Select an option

  • Save a5r0n/57300bdad7b31652292c36e0beee6bb1 to your computer and use it in GitHub Desktop.

Select an option

Save a5r0n/57300bdad7b31652292c36e0beee6bb1 to your computer and use it in GitHub Desktop.
name: Docker Image CI
on:
push:
branches: [develop]
tags:
- "v*"
pull_request:
branches: [master, develop]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.6.0-rc1
driver-opts: image=moby/buildkit:v0.9.0-rc2
buildkitd-flags: --debug
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment