|
| 1 | +name: MultiArchDockerBuild |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + docker: |
| 9 | + name: Build multi-arch Docker image. |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: tag number |
| 13 | + run : echo ${{ github.event.release.tag_name }} |
| 14 | + |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up QEMU |
| 19 | + uses: docker/setup-qemu-action@v3 |
| 20 | + |
| 21 | + - name: Set up Docker Buildx |
| 22 | + id: buildx |
| 23 | + uses: docker/setup-buildx-action@v3 |
| 24 | + with: |
| 25 | + install: true |
| 26 | + |
| 27 | + - name: Login to DockerHub |
| 28 | + uses: docker/login-action@v3 |
| 29 | + with: |
| 30 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 31 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Login to GitHub Container Registry |
| 34 | + uses: docker/login-action@v3 |
| 35 | + with: |
| 36 | + registry: ghcr.io |
| 37 | + username: ${{ github.repository_owner }} |
| 38 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + - name: Set lower case owner name |
| 41 | + run: | |
| 42 | + echo "REG_REPO=${REPO,,}" >> ${GITHUB_ENV} |
| 43 | + env: |
| 44 | + REPO: '${{ github.repository }}' |
| 45 | + |
| 46 | + - name: Check env |
| 47 | + run: | |
| 48 | + echo ${{ env.REG_REPO }} |
| 49 | +
|
| 50 | + - name: Build and push |
| 51 | + uses: docker/build-push-action@v5 |
| 52 | + with: |
| 53 | + context: . |
| 54 | + platforms: linux/amd64,linux/arm64,linux/arm/v7 |
| 55 | + push: true |
| 56 | + tags: | |
| 57 | + ${{ secrets.DOCKERHUB_USERNAME }}/jacred:latest |
| 58 | + ${{ secrets.DOCKERHUB_USERNAME }}/jacred:${{ github.event.release.tag_name }} |
| 59 | + ghcr.io/${{ env.REG_REPO }}:latest |
| 60 | + ghcr.io/${{ env.REG_REPO }}:${{ github.event.release.tag_name }} |
| 61 | + cache-from: type=gha,scope=${{ github.workflow }} |
| 62 | + cache-to: type=gha,mode=max,scope=${{ github.workflow }} |
0 commit comments