mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-11 23:58:46 +08:00
update:Docker Image CI/CD
This commit is contained in:
10
.github/workflows/docker-image.yml
vendored
10
.github/workflows/docker-image.yml
vendored
@@ -2,6 +2,7 @@ name: Docker Image CI/CD
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: [ "v*.*.*" ] # 支持标签触发(如 v1.0.0)
|
tags: [ "v*.*.*" ] # 支持标签触发(如 v1.0.0)
|
||||||
|
workflow_dispatch: # 添加手动触发
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -26,11 +27,18 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 设置 QEMU 支持多架构
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: 设置 Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: 构建并推送 Docker 镜像
|
- name: 构建并推送 Docker 镜像
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name == 'push' }} # 仅推送代码时上传镜像
|
platforms: linux/amd64,linux/arm64 # 指定架构:x86_64 和 ARM64
|
||||||
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ env.LOWER_NAME }}:latest
|
ghcr.io/${{ env.LOWER_NAME }}:latest
|
||||||
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}
|
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}
|
||||||
|
|||||||
Reference in New Issue
Block a user