refactor(.gitea/.github): 简化CI/CD流程,优化Docker镜像构建与推送 #4
This file contains hidden or 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 Docker Image to GitHub Container Registry | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 检出代码 | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # 设置 Docker Buildx | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| # 登录到 GitHub Container Registry | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} # GitHub 用户名 | |
| password: ${{ secrets.TOKEN }} # GitHub 自动生成的令牌 | |
| # 添加调试步骤 | |
| - name: Test Network Connection | |
| run: curl -I https://download.pytorch.org/whl/rocm6.2 | |
| # 构建并推送 Docker 镜像 | |
| - name: Build and push Docker image to GitHub Container Registry | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . # 当前目录作为构建上下文 | |
| file: ./Dockerfile # Dockerfile 路径 | |
| push: true # 推送镜像 | |
| tags: ghcr.io/inknight-dednet/comfy_container_ui/c_c_u:latest # 镜像推送到 GitHub 包注册表 |