Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Introduce multiarch docker image build #466

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
tags:
- '*'
release:
types:
- created
name: Build release
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: frabert/replace-string-action@master
id: formatted_version
with:
pattern: '[v]*(.*)$'
string: "${{ steps.get_version.outputs.VERSION }}"
replace-with: '$1'
flags: 'g'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
registry: ${{ secrets.DOCKER_REGISTRY }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.multiarch
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_ORGANIZATION }}/kiam:${{ steps.formatted_version.outputs.replaced }}
22 changes: 22 additions & 0 deletions Dockerfile.multiarch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.13.8 as build
ENV GO111MODULE=on

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

COPY cmd/ cmd/
COPY pkg/ pkg/
COPY proto/ proto/
COPY Makefile Makefile

RUN CGO_ENABLED=0 go build -o bin/kiam cmd/kiam/*.go

FROM alpine:3.11
RUN apk --no-cache add iptables
COPY --from=build /workspace/bin/kiam /kiam
CMD []