-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github workflow to build docker image
- Loading branch information
1 parent
e05d1c2
commit 852c87b
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
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 |