Skip to content

Commit

Permalink
ci(docker): Add docker CI
Browse files Browse the repository at this point in the history
Signed-off-by: 陳鈞 <jim60105@gmail.com>
  • Loading branch information
jim60105 committed Feb 17, 2024
1 parent 433e287 commit fc029d7
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: docker_publish

on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- "*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Docker meta data
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/konhya_ss

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

# Create a Access Token with `read:packages` and `write:packages` scopes
# CR_PAT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

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

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

0 comments on commit fc029d7

Please sign in to comment.