feat(Docker): add GitHub Actions workflow for building and pushing Docker image

This commit is contained in:
shiyu
2025-05-23 21:52:41 +08:00
parent 3feb71493f
commit c3e012e1ae
3 changed files with 48 additions and 18 deletions

35
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Build and Push Docker image
on:
push:
branches:
- '**'
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Lowercase repo name
run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ env.REPO_LC }}:dev