|
| 1 | +name: Build and publish Docker image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + tags: |
| 9 | + - "*.*.*" |
| 10 | + |
| 11 | +jobs: |
| 12 | + multiarch-build: |
| 13 | + name: Build and publish image |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Get Docker tags |
| 22 | + id: docker_meta |
| 23 | + uses: docker/metadata-action@v5 |
| 24 | + with: |
| 25 | + images: | |
| 26 | + nginxproxy/${{ github.event.repository.name }} |
| 27 | + tags: | |
| 28 | + type=semver,pattern={{version}} |
| 29 | + type=semver,pattern={{major}}.{{minor}} |
| 30 | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} |
| 31 | + labels: | |
| 32 | + org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag) |
| 33 | + flavor: | |
| 34 | + latest=false |
| 35 | +
|
| 36 | + - name: Set up QEMU |
| 37 | + uses: docker/setup-qemu-action@v3 |
| 38 | + |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@v3 |
| 41 | + |
| 42 | + - name: Login to DockerHub |
| 43 | + uses: docker/login-action@v3 |
| 44 | + with: |
| 45 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 46 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 47 | + |
| 48 | + - name: Build and push the image |
| 49 | + id: docker_build |
| 50 | + uses: docker/build-push-action@v5 |
| 51 | + with: |
| 52 | + context: . |
| 53 | + platforms: linux/amd64,linux/arm64,linux/s390x,linux/arm/v7 |
| 54 | + sbom: true |
| 55 | + push: true |
| 56 | + provenance: mode=max |
| 57 | + tags: ${{ steps.docker_meta.outputs.tags }} |
| 58 | + labels: ${{ steps.docker_meta.outputs.labels }} |
| 59 | + cache-from: type=gha |
| 60 | + cache-to: type=gha,mode=max |
| 61 | + |
| 62 | + - name: Images digests |
| 63 | + run: echo ${{ steps.docker_build.outputs.digest }} |
0 commit comments