Skip to content

Commit

Permalink
Build multiplatform docker image (#56)
Browse files Browse the repository at this point in the history
* update actions

* add arm&amd platforms

* Release preparation v0.5.5

---------

Co-authored-by: Marek Hornak <marek@xco.sk>
  • Loading branch information
an-tex and xco-sk authored May 10, 2023
1 parent 34684bf commit 6aac773
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -28,18 +28,19 @@ jobs:
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.17 as builder
FROM --platform=$BUILDPLATFORM golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -15,8 +15,10 @@ COPY apis/ apis/
COPY utils/ utils/
COPY controllers/ controllers/

ARG TARGETOS TARGETARCH

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
4 changes: 2 additions & 2 deletions charts/eck-custom-resources-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ maintainers:
email: marek@xco.sk
url: https://github.com/xco-sk
type: application
version: 0.5.4
appVersion: 0.5.4
version: 0.5.5
appVersion: 0.5.5
2 changes: 1 addition & 1 deletion charts/eck-custom-resources-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Helm chart for eck-custom-resources

![Version: 0.5.4](https://img.shields.io/badge/Version-0.5.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.4](https://img.shields.io/badge/AppVersion-0.5.4-informational?style=flat-square)
![Version: 0.5.5](https://img.shields.io/badge/Version-0.5.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.5](https://img.shields.io/badge/AppVersion-0.5.5-informational?style=flat-square)

Helm chart for eck-custom-resources operator

Expand Down

0 comments on commit 6aac773

Please sign in to comment.