diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b603a870..b73a962e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,28 +21,42 @@ jobs: cd config/release kustomize edit set image fluxcd/notification-controller=fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} kustomize build . > notification-controller.yaml - - uses: crazy-max/ghaction-docker-buildx@v1 - - name: Publish image - run: | - echo "${{ secrets.DOCKER_FLUXCD_PASSWORD }}" | docker login --username fluxcdbot --password-stdin - echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io --username fluxcdbot --password-stdin - - docker buildx build --platform "linux/amd64" \ - --output "type=image,push=true" \ - --build-arg "REVISION=${GITHUB_SHA}" \ - --build-arg "VERSION=${{ steps.get_version.outputs.VERSION }}" \ - --build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag "ghcr.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }}" \ - --tag "docker.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }}" \ - --file Dockerfile . - - docker buildx build --platform "linux/arm64" \ - --output "type=image,push=true" \ - --build-arg "REVISION=${GITHUB_SHA}" \ - --build-arg "VERSION=${{ steps.get_version.outputs.VERSION }}" \ - --build-arg "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --tag "ghcr.io/fluxcd/notification-controller-arm64:${{ steps.get_version.outputs.VERSION }}" \ - --file Dockerfile . + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: fluxcdbot + password: ${{ secrets.GHCR_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: fluxcdbot + password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} + - name: Publish amd64 image + uses: docker/build-push-action@v2-build-push + with: + push: ${{ github.event_name != 'pull_request' }} + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64 + tags: ghcr.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }},docker.io/fluxcd/notification-controller:${{ steps.get_version.outputs.VERSION }} + - name: Publish arm64 image + uses: docker/build-push-action@v2-build-push + with: + push: ${{ github.event_name != 'pull_request' }} + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/arm64 + tags: ghcr.io/fluxcd/notification-controller-arm64:${{ steps.get_version.outputs.VERSION }} - name: Create release id: create_release uses: actions/create-release@latest diff --git a/Dockerfile b/Dockerfile index afe53a53c..f803d0192 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,18 +20,6 @@ RUN CGO_ENABLED=0 go build -a -o notification-controller main.go FROM alpine:3.12 -ARG BUILD_DATE -ARG VERSION -ARG REVISION - -LABEL org.opencontainers.image.created=$BUILD_DATE \ - org.opencontainers.image.version=$VERSION \ - org.opencontainers.image.revision=$REVISION \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.source="https://github.com/fluxcd/notification-controller" \ - org.opencontainers.image.documentation="https://toolkit.fluxcd.io" \ - org.opencontainers.image.authors="Flux CD" - RUN apk add --no-cache ca-certificates tini COPY --from=builder /workspace/notification-controller /usr/local/bin/