Attempt to reduce memory requirements for docker build
Docker / build-and-push-image (push) Successful in 4m38s
Docker / build-and-push-image (push) Successful in 4m38s
This commit is contained in:
+11
-2
@@ -1,7 +1,13 @@
|
|||||||
FROM golang AS build
|
FROM --platform=$BUILDPLATFORM golang:1.25 AS build
|
||||||
|
|
||||||
|
ARG TARGETOS TARGETARCH
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
@@ -9,7 +15,10 @@ RUN go mod download
|
|||||||
COPY zooid zooid
|
COPY zooid zooid
|
||||||
COPY cmd cmd
|
COPY cmd cmd
|
||||||
|
|
||||||
RUN CGO_ENABLED=1 GOOS=linux go build -o bin/zooid cmd/relay/main.go
|
RUN set -eux; \
|
||||||
|
if [ "$TARGETARCH" = "arm64" ]; then export CC=aarch64-linux-gnu-gcc; fi; \
|
||||||
|
CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
|
go build -o bin/zooid cmd/relay/main.go
|
||||||
|
|
||||||
FROM gcr.io/distroless/base-debian12 AS run
|
FROM gcr.io/distroless/base-debian12 AS run
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user