We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 667cc2d commit d5f162fCopy full SHA for d5f162f
1 file changed
Dockerfile
@@ -4,6 +4,9 @@ FROM golang:1.25.3-alpine AS builder
4
# Set the working directory inside the container
5
WORKDIR /app
6
7
+# Install build dependencies
8
+RUN apk add --no-cache gcc musl-dev
9
+
10
# Copy go mod and sum files
11
COPY go.mod go.sum ./
12
@@ -13,8 +16,10 @@ RUN go mod download
13
16
# Copy the source code into the container
14
17
COPY . .
15
18
-# Build the Go app
-RUN go build -o curl-live .
19
+# Build the Go app with optimized settings for cross-platform builds
20
+ARG TARGETOS
21
+ARG TARGETARCH
22
+RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -installsuffix cgo -o curl-live .
23
24
# Use a minimal alpine image for the final stage
25
FROM alpine:latest
0 commit comments