返回 MoneyPrinterTurbo
docker-ghcr.yml
根目录 / .github / workflows / docker-ghcr.yml
1 name: Publish Docker image
2
3 on:
4 push:
5 branches:
6 - main
7 tags:
8 - "v*"
9 workflow_dispatch:
10
11 permissions:
12 contents: read
13 packages: write
14
15 concurrency:
16 group: docker-ghcr-${{ github.ref }}
17 cancel-in-progress: true
18
19 env:
20 IMAGE_NAME: ghcr.io/harry0703/moneyprinterturbo
21
22 jobs:
23 publish:
24 name: Build and publish
25 runs-on: ubuntu-latest
26 timeout-minutes: 90
27
28 steps:
29 - name: Check out repository
30 uses: actions/checkout@v4
31
32 - name: Set up QEMU
33 uses: docker/setup-qemu-action@v3
34
35 - name: Set up Docker Buildx
36 uses: docker/setup-buildx-action@v3
37
38 - name: Log in to GHCR
39 uses: docker/login-action@v3
40 with:
41 registry: ghcr.io
42 username: ${{ github.actor }}
43 password: ${{ secrets.GITHUB_TOKEN }}
44
45 - name: Extract Docker metadata
46 id: meta
47 uses: docker/metadata-action@v5
48 with:
49 images: ${{ env.IMAGE_NAME }}
50 tags: |
51 type=ref,event=branch
52 type=ref,event=tag
53 type=semver,pattern={{version}}
54 type=raw,value=latest,enable={{is_default_branch}}
55
56 - name: Build and push Docker image
57 uses: docker/build-push-action@v6
58 with:
59 context: .
60 file: ./Dockerfile
61 push: true
62 platforms: linux/amd64,linux/arm64
63 build-args: |
64 DOCKER_BUILD_MIRROR=default
65 PIP_USE_OFFICIAL=1
66 tags: ${{ steps.meta.outputs.tags }}
67 labels: ${{ steps.meta.outputs.labels }}
68 cache-from: type=gha
69 cache-to: type=gha,mode=max
70
70 lines YAML