Files
nexus-terminal/.github/workflows/docker-publish.yml
T
yinjianm 33a027e809 ci(config): add GHCR image publish workflow
Publish frontend, backend, and remote-gateway images to GHCR on
pushes to main and manual runs. Also update docker-compose to pull
the three service images from ghcr.io instead of Docker Hub.
2026-03-25 03:28:45 +08:00

64 lines
1.6 KiB
YAML

name: Docker Publish
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- service: frontend
dockerfile: packages/frontend/Dockerfile
- service: backend
dockerfile: packages/backend/Dockerfile
- service: remote-gateway
dockerfile: packages/remote-gateway/Dockerfile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/nexus-terminal-${{ matrix.service }}
tags: |
type=raw,value=latest
type=sha,format=short,prefix=sha-
- name: Build and push ${{ matrix.service }}
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max,scope=${{ matrix.service }}