Merge pull request #130 from fluxcd/arm64

Publish amd64/arm64 images to GHCR
This commit is contained in:
Stefan Prodan 2020-09-04 13:54:28 +03:00 committed by GitHub
commit ed27b24fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 8 deletions

View File

@ -21,13 +21,44 @@ jobs:
cd config/release
kustomize edit set image fluxcd/source-controller=fluxcd/source-controller:${{ steps.get_version.outputs.VERSION }}
kustomize build . > source-controller.yaml
- name: Push image
uses: docker/build-push-action@v1
- name: Setup QEMU
uses: docker/setup-qemu-action@master
with:
username: ${{ secrets.DOCKER_FLUXCD_USER }}
platforms: all
- name: Setup 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 }}
repository: fluxcd/source-controller
tag_with_ref: true
- 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/source-controller:${{ steps.get_version.outputs.VERSION }}
docker.io/fluxcd/source-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/source-controller-arm64:${{ steps.get_version.outputs.VERSION }}
- name: Create release
id: create_release
uses: actions/create-release@latest

View File

@ -1,4 +1,5 @@
FROM golang:1.14 as builder
# Docker buildkit multi-arch build requires golang alpine
FROM golang:1.14-alpine as builder
WORKDIR /workspace
@ -18,11 +19,14 @@ COPY controllers/ controllers/
COPY pkg/ pkg/
COPY internal/ internal/
# build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o source-controller main.go
# build without specifing the arch
RUN CGO_ENABLED=0 go build -a -o source-controller main.go
FROM alpine:3.12
# link repo to the GitHub Container Registry image
LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller"
RUN apk add --no-cache ca-certificates tini
COPY --from=builder /workspace/source-controller /usr/local/bin/