Skip to content

Instantly share code, notes, and snippets.

@mateiidavid
Last active May 21, 2024 09:09
Show Gist options
  • Save mateiidavid/cd32ff0c6ac42d9ff35107bb76f2bfae to your computer and use it in GitHub Desktop.
Save mateiidavid/cd32ff0c6ac42d9ff35107bb76f2bfae to your computer and use it in GitHub Desktop.
bb-build
From 651fc60940513e6a0f620813e2d6b1dafe54e0cd Mon Sep 17 00:00:00 2001
From: Matei David <[email protected]>
Date: Tue, 21 May 2024 09:04:19 +0000
Subject: [PATCH] Patch
Signed-off-by: Matei David <[email protected]>
---
Dockerfile | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 3741edc..2d9dda8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,19 @@
-FROM golang:1.11.6-stretch as golang
-WORKDIR /go/src/github.com/buoyantio/bb
-ADD . /go/src/github.com/buoyantio/bb
+ARG BUILDPLATFORM=linux/amd64
-RUN mkdir -p /out
-RUN ./bin/dep ensure
-RUN go build -o /out/bb .
+FROM --platform=$BUILDPLATFORM golang:1.22-alpine as build
+ARG TARGETARCH
+WORKDIR /build
+COPY go.mod .
+COPY go.sum .
+RUN go mod download
+COPY . .
+RUN mkdir -p /out && \
+CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -installsuffix cgo -o ./out/bb
-FROM gcr.io/linkerd-io/base:2019-02-19.01
-RUN apt-get update
-RUN apt-get install -y ca-certificates
-COPY --from=golang /out /out
+FROM alpine:3.19 as runtime
+RUN apk --update upgrade && \
+ apk add ca-certificates && \
+ update-ca-certificates && \
+ rm -rf /var/cache/apk/*
+COPY --from=build /build/out /out
ENTRYPOINT ["/out/bb"]
--
2.34.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment