This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Multi-Arch Docker Image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 检出代码 | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# 设置 QEMU 以支持跨架构构建 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# 设置 Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# 登录到 Docker Hub | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# 构建并推送多平台 Docker 镜像 | |
- name: Build and Push Multi-Arch Docker Image | |
run: | | |
docker buildx create --use | |
docker buildx build --platform linux/amd64,linux/arm64 -t jaaksi/sublinkx:latest --push . |