ci: Update buildx

This commit is contained in:
stefanprodan 2020-09-02 13:39:10 +03:00
parent feb6b3050f
commit 8a5e467ffb
2 changed files with 36 additions and 34 deletions

View File

@ -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

View File

@ -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/