|
| 1 | +name: GIN-VUE-ADMIN Docker Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [stopstopstop] |
| 6 | + #workflow_dispatch: |
| 7 | + # inputs: |
| 8 | + # webtag: |
| 9 | + # description: 'Set web tag, Default latest' |
| 10 | + # required: true |
| 11 | + # default: "latest" |
| 12 | + # servertag: |
| 13 | + # description: 'Set server tag, Default latest' |
| 14 | + # required: true |
| 15 | + # default: "latest" |
| 16 | + |
| 17 | +jobs: |
| 18 | + GIN_VUE_ADMIN_WEB: |
| 19 | + name: GIN VUE ADMIN WEB |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Private Actions Checkout |
| 23 | + uses: actions/checkout@v2.3.4 |
| 24 | + - name: Docker Setup QEMU |
| 25 | + uses: docker/setup-qemu-action@v1.2.0 |
| 26 | + - name: Docker Setup Buildx |
| 27 | + uses: docker/setup-buildx-action@v1.6.0 |
| 28 | + - name: Docker Login |
| 29 | + uses: docker/login-action@v1.10.0 |
| 30 | + with: |
| 31 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 32 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 33 | + - name: Docker Login in Aliyun |
| 34 | + uses: docker/login-action@v1.10.0 |
| 35 | + with: |
| 36 | + registry: ${{ secrets.DOCKERHUB_REGISTRY_ALIYUN }} |
| 37 | + username: ${{ secrets.DOCKERHUB_ACCOUNT_ALIYUN }} |
| 38 | + password: ${{ secrets.DOCKERHUB_PASSWORD_ALIYUN }} |
| 39 | + - name: Build and push Docker images |
| 40 | + uses: docker/build-push-action@v2.7.0 |
| 41 | + with: |
| 42 | + context: . |
| 43 | + # 这里是适配 arm64 ,主要看你们的程序是否支持 arm64 |
| 44 | + platforms: linux/amd64,linux/arm64 |
| 45 | + file: web/Dockerfile |
| 46 | + push: true |
| 47 | + # 这里是给docker 打标签,默认不上传 latest |
| 48 | + tags: | |
| 49 | + ${{ secrets.DOCKERHUB_USERNAME }}/web:${{ github.event.inputs.webtag }} |
| 50 | + ${{ secrets.DOCKERHUB_REGISTRY_ALIYUN }}/${{ secrets.DOCKERHUB_USERNAME_ALIYUN }}web:${{ github.event.inputs.webtag }} |
| 51 | + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/web:${{ github.event.inputs.webtag }}.cache |
| 52 | + cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/web:${{ github.event.inputs.webtag }}.cache,mode=max |
| 53 | + # 漏洞扫描 |
| 54 | + - name: Scan for vulnerabilities |
| 55 | + uses: crazy-max/ghaction-container-scan@v1 |
| 56 | + with: |
| 57 | + image: ${{ secrets.DOCKERHUB_USERNAME }}/web:${{ github.event.inputs.webtag }} |
| 58 | + dockerfile: web/Dockerfile |
| 59 | + # 更新 docker 描述页面 |
| 60 | + - name: Docker Hub Description |
| 61 | + uses: peter-evans/dockerhub-description@v2 |
| 62 | + with: |
| 63 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 64 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 65 | + repository: ${{ secrets.DOCKERHUB_USERNAME }}/web |
| 66 | + |
| 67 | + GIN_VUE_ADMIN_SERVER: |
| 68 | + name: GIN VUE ADMIN SERVER |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - name: Private Actions Checkout |
| 72 | + uses: actions/checkout@v2.3.4 |
| 73 | + - name: Docker Setup QEMU |
| 74 | + uses: docker/setup-qemu-action@v1.2.0 |
| 75 | + - name: Docker Setup Buildx |
| 76 | + uses: docker/setup-buildx-action@v1.6.0 |
| 77 | + - name: Docker Login |
| 78 | + uses: docker/login-action@v1.10.0 |
| 79 | + with: |
| 80 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 81 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 82 | + - name: Docker Login in Aliyun |
| 83 | + uses: docker/login-action@v1.10.0 |
| 84 | + with: |
| 85 | + registry: ${{ secrets.DOCKERHUB_REGISTRY_ALIYUN }} |
| 86 | + username: ${{ secrets.DOCKERHUB_ACCOUNT_ALIYUN }} |
| 87 | + password: ${{ secrets.DOCKERHUB_PASSWORD_ALIYUN }} |
| 88 | + - name: Build and push Docker images |
| 89 | + uses: docker/build-push-action@v2.7.0 |
| 90 | + with: |
| 91 | + context: . |
| 92 | + # 这里是适配 arm64 ,主要看你们的程序是否支持 arm64 |
| 93 | + platforms: linux/amd64,linux/arm64 |
| 94 | + file: server/Dockerfile |
| 95 | + push: true |
| 96 | + # 这里是给docker 打标签,默认不上传 latest |
| 97 | + tags: | |
| 98 | + ${{ secrets.DOCKERHUB_USERNAME }}/server:${{ github.event.inputs.servertag }} |
| 99 | + ${{ secrets.DOCKERHUB_REGISTRY_ALIYUN }}/${{ secrets.DOCKERHUB_USERNAME_ALIYUN }}server:${{ github.event.inputs.servertag }} |
| 100 | + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/server:${{ github.event.inputs.servertag }}.cache |
| 101 | + cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/server:${{ github.event.inputs.servertag }}.cache,mode=max |
| 102 | + # 漏洞扫描 |
| 103 | + - name: Scan for vulnerabilities |
| 104 | + uses: crazy-max/ghaction-container-scan@v1 |
| 105 | + with: |
| 106 | + image: ${{ secrets.DOCKERHUB_USERNAME }}/server:${{ github.event.inputs.servertag }} |
| 107 | + dockerfile: server/Dockerfile |
| 108 | + # 更新 docker 描述页面 |
| 109 | + - name: Docker Hub Description |
| 110 | + uses: peter-evans/dockerhub-description@v2 |
| 111 | + with: |
| 112 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 113 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 114 | + repository: ${{ secrets.DOCKERHUB_USERNAME }}/server |
0 commit comments