Delete Dockerfile-SD-Trainer #7
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: Dockerfile-SD-Trainer | |
| on: | |
| push: | |
| paths: ['Dockerfile-SD-Trainer'] | |
| workflow_dispatch: | |
| inputs: | |
| env: | |
| description: '手动触发' | |
| default: 'prod' | |
| # 只需要修改这里的变量就可以,如非必要,jobs下的参数不要动 | |
| env: | |
| own: joybo # 需要修改为你的阿里云命名空间 | |
| repo: $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) # 获取当前仓库的名称,阿里云需要创建同名仓库 | |
| server: registry.cn-hangzhou.aliyuncs.com # 你的阿里云服务器地址(不同区域的地址不一样) | |
| server-id: cn-hangzhou # 服务器ID,看上面就可以 | |
| TZ: Asia/Shanghai | |
| jobs: | |
| Docker-Build-Release: | |
| if: ${{ github.ref == 'refs/heads/main' }} # 检测main分支是否有更新 | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 增加可用磁盘空间 | |
| - name: Maximize build space | |
| uses: easimon/maximize-build-space@master | |
| with: | |
| root-reserve-mb: 2048 | |
| swap-size-mb: 128 | |
| remove-dotnet: 'true' | |
| remove-haskell: 'true' | |
| # 如果空间还是不够用,可以把以下开启,清理出更多空间 | |
| # remove-android: 'true' | |
| # remove-codeql: 'true' | |
| build-mount-path: '/var/lib/docker/' | |
| - name: Restart docker | |
| run: sudo service docker restart | |
| - name: Free up disk space complete | |
| run: | | |
| echo "Free up disk space complete" | |
| echo "==============================================================================" | |
| df -hT | |
| echo "==============================================================================" | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Docker Setup Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: 获取当前日期 | |
| id: date | |
| run: echo "::set-output name=date::$(date +v%Y.%m.%d)" | |
| - uses: actions/checkout@v2 # pull代码到运行服务器上 | |
| - name: 登录阿里云仓库 | |
| uses: aliyun/acr-login@v1 # 使用阿里云镜像服务action | |
| with: | |
| login-server: ${{ env.server}} # 务必正确填写镜像容器服务的登录地址 | |
| region-id: ${{ env.server-id }} # 务必正确填写镜像容器服务的登录地址 | |
| username: "${{ secrets.REGISTRY_USERNAME }}" # 引用GitHub repo设置的镜像容器服务用户名 | |
| password: "${{ secrets.REGISTRY_PASSWORD }}" # 引用GitHub repo设置的镜像容器服务密码 | |
| - name: 构建和上传Docker镜像 | |
| run: | | |
| docker build -t ${{ env.server }}/${{ env.own }}/${{ env.repo }}:${{ steps.date.outputs.date }}-action-sd-trainer -f Dockerfile-SD-Trainer . | |
| docker push ${{ env.server }}/${{ env.own }}/${{ env.repo }}:${{ steps.date.outputs.date }}-action-sd-trainer | |
| - name: Docker Pull 命令 | |
| run: echo "docker pull ${{ env.server }}/${{ env.own }}/${{ env.repo }}:${{ steps.date.outputs.date }}-action-sd-trainer" |