mirror of
https://github.com/fish2018/pansou.git
synced 2025-11-25 03:14:59 +08:00
54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths-ignore:
|
|
- "README.md"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
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: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GHCR_PAT }}
|
|
|
|
- name: Set GHCR_REPO and GHCR_OWNER env
|
|
run: |
|
|
echo "GHCR_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
|
|
echo "GHCR_REPO=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}" >> $GITHUB_ENV
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ${{ env.GHCR_REPO }}
|
|
|
|
- name: Build and push to GHCR
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ env.GHCR_REPO }}:latest
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|