Skip to content

Commit

Permalink
Add github workflow to build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
minetoblend committed Aug 7, 2024
1 parent e05d1c2 commit 852c87b
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Docker image to GitHub Packages

on:
push:
branches: ["main"]
paths-ignore: ["README.md"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: hifumin
IMAGE_NAME_SERVER: ${{ github.repository }}

jobs:
docker:
name: Build and push Docker images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker Client Meta
id: meta-client
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,prefix=
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push docker image
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
platforms: linux/amd64
tags: ${{ steps.meta-client.outputs.tags }}
labels: ${{ steps.meta-client.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: true

0 comments on commit 852c87b

Please sign in to comment.