diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index e962d8f3..cdb39e48 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -33,11 +33,11 @@ jobs: fetch-depth: 0 - name: Retrieve version - run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV + id: docker-gen_version + run: echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT" - - name: Get Docker tags for Alpine based image - if: ${{ matrix.base == 'alpine' }} - id: docker_meta_alpine + - name: Get Docker tags + id: docker_meta uses: docker/metadata-action@v4 with: images: | @@ -45,30 +45,17 @@ jobs: nginxproxy/docker-gen jwilder/docker-gen tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}},enable=${{ matrix.base == 'alpine' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'alpine' }} + type=semver,suffix=-debian,pattern={{version}},enable=${{ matrix.base == 'debian' }} + type=semver,suffix=-debian,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'debian' }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'alpine' }} + type=raw,value=debian,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'debian' }} labels: | org.opencontainers.image.authors=Nicolas Duchon (@buchdag), Jason Wilder - org.opencontainers.image.version=${{ env.GIT_DESCRIBE }} - - - name: Get Docker tags for Debian based image - if: ${{ matrix.base == 'debian' }} - id: docker_meta_debian - uses: docker/metadata-action@v4 - with: - images: | - ghcr.io/nginx-proxy/docker-gen - nginxproxy/docker-gen - jwilder/docker-gen - tags: | - type=semver,suffix=-debian,pattern={{version}} - type=semver,suffix=-debian,pattern={{major}}.{{minor}} - type=raw,value=debian,enable={{is_default_branch}} - labels: | - org.opencontainers.image.authors=Nicolas Duchon (@buchdag), Jason Wilder - org.opencontainers.image.version=${{ env.GIT_DESCRIBE }} - flavor: latest=false + org.opencontainers.image.version=${{ steps.docker-gen_version.outputs.VERSION }} + flavor: | + latest=false - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -89,35 +76,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push the Alpine based image - if: ${{ matrix.base == 'alpine' }} - id: docker_build_alpine - uses: docker/build-push-action@v4 - with: - context: . - build-args: DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: true - tags: ${{ steps.docker_meta_alpine.outputs.tags }} - labels: ${{ steps.docker_meta_alpine.outputs.labels }} - - - name: Build and push the Debian based image - if: ${{ matrix.base == 'debian' }} - id: docker_build_debian + - name: Build and push the image + id: docker_build uses: docker/build-push-action@v4 with: context: . - build-args: DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }} - file: Dockerfile.debian - platforms: linux/amd64,linux/arm64,linux/arm/v7 + build-args: DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }} + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x + file: Dockerfile.${{ matrix.base }} push: true - tags: ${{ steps.docker_meta_debian.outputs.tags }} - labels: ${{ steps.docker_meta_debian.outputs.labels }} - - - name: Alpine based image digest - if: ${{ matrix.base == 'alpine' }} - run: echo ${{ steps.docker_build_alpine.outputs.digest }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max - - name: Debian based image digest - if: ${{ matrix.base == 'debian' }} - run: echo ${{ steps.docker_build_debian.outputs.digest }} + - name: Docker image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile.alpine similarity index 100% rename from Dockerfile rename to Dockerfile.alpine