Skip to content

Commit

Permalink
Multi-platform kubestr image (#316)
Browse files Browse the repository at this point in the history
* multi-platform kubestr image

* Adjusting Dockerfile to do a native compile + emulated image build

* remove explicit TARGETPLATFORM
  • Loading branch information
bathina2 authored Dec 3, 2024
1 parent 1140b95 commit dc40661
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM golang:1.22-bullseye AS builder
ARG BUILDPLATFROM

FROM --platform=$BUILDPLATFORM golang:1.22-bookworm AS builder

ARG TARGETOS
ARG TARGETARCH
ARG TARGETPLATFROM

ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
GOBIN=/dist
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH}

WORKDIR /app

Expand All @@ -15,7 +20,7 @@ RUN go mod download

COPY . .

RUN go install -ldflags="-w -s" .
RUN go build -o /dist/kubestr -ldflags="-w -s" .

FROM alpine:3.19

Expand Down

0 comments on commit dc40661

Please sign in to comment.