Skip to content

Commit

Permalink
feat: add arm binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Fritz Durchardt authored and linusfr committed Aug 31, 2023
1 parent 7f5fa93 commit a74d63e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Stage 1 Build myks
FROM golang:1.21 AS builder

FROM --platform=$BUILDPLATFORM golang:1.21 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app

COPY . .
Expand All @@ -9,40 +10,44 @@ RUN go mod download \
&& go mod verify

RUN CGO_ENABLED=0 \
go build -trimpath -o myks main.go
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o myks main.go


# Stage 2 Download tools
FROM debian:bookworm AS download-tools
FROM --platform=$BUILDPLATFORM debian:bookworm AS download-tools

ARG TARGETOS
ARG TARGETARCH
ARG HELM_VERSION=3.11.2
ARG VENDIR_VERSION=0.33.1
ARG YTT_VERSION=0.45.0

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
unzip

ARG HELM_VERSION=3.11.2
ARG VENDIR_VERSION=0.33.1
ARG YTT_VERSION=0.45.0

WORKDIR /tools

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN curl -fsSL \
https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz \
| tar -xzf - --strip-components=1 linux-amd64/helm
https://get.helm.sh/helm-v${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz \
| tar -xzf - --strip-components=1 ${TARGETOS}-${TARGETARCH}/helm
RUN curl -fsSL \
https://github.com/vmware-tanzu/carvel-vendir/releases/download/v${VENDIR_VERSION}/vendir-linux-amd64 \
https://github.com/vmware-tanzu/carvel-vendir/releases/download/v${VENDIR_VERSION}/vendir-${TARGETOS}-${TARGETARCH} \
> vendir
RUN curl -fsSL \
https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-linux-amd64 \
https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-${TARGETOS}-${TARGETARCH} \
> ytt
RUN chmod +x *


# Stage 3: Bring it all together
FROM debian:bookworm
FROM --platform=$BUILDPLATFORM debian:bookworm

WORKDIR /app

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
Expand Down

0 comments on commit a74d63e

Please sign in to comment.