Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.24.4-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.24.4-alpine AS builder

# Install dependencies
RUN apk add --no-cache git
Expand All @@ -16,8 +16,16 @@ RUN go mod download
# Copy source code
COPY . .

# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/transformer
# Build args from buildx
ARG TARGETOS
ARG TARGETARCH

# Build static binary for correct platform
RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH \
go build -trimpath -ldflags="-s -w" \
-o main ./cmd/transformer

# Final stage
FROM alpine:latest
Expand Down