feat(server): add Dockerfile + CI docker build/push (#10)

* feat: add server Docker image build (Dockerfile + GH Actions)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Nick
2025-12-26 20:56:08 +08:00
committed by GitHub
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent 19c2e054a9
commit 09faf443ce
4 changed files with 179 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
name: Docker (server)
on:
pull_request:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: docker-server-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-server
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Build and (optionally) push
uses: docker/build-push-action@v6
with:
context: .
file: server/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max