ci: publish container image to ghcr

This commit is contained in:
2026-05-31 23:52:25 +08:00
parent 1fb1e6d7de
commit 472ff5e205
2 changed files with 64 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
name: Release Image
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+11
View File
@@ -164,3 +164,14 @@ Example:
make build CONTAINER_ENGINE=docker IMAGE_TAG=dev
make run CONTAINER_ENGINE=docker PORT=8080 ENV_FILE=.env
```
## GitHub Packages (GHCR)
- Automated image publishing is configured in `.github/workflows/release-image.yml`.
- On push of a release tag (for example `v0.2.0`), CI builds and pushes:
- `ghcr.io/furyhawk/api_gateway:v0.2.0`
- `ghcr.io/furyhawk/api_gateway:latest`
Pull example:
```bash
docker pull ghcr.io/furyhawk/api_gateway:v0.2.0
```