# Stage 1: Build the Go binary FROM golang:1.24.4-alpine AS builder # Set working directory inside the build container WORKDIR /app # Copy Go module files and source code COPY go.mod ./ RUN go mod download COPY . . # Build the Go binary statically RUN CGO_ENABLED=0 GOOS=linux go build -o docker-api-proxy . # Stage 2: Run binary in minimal container FROM scratch # Copy binary from builder COPY --from=builder /app/docker-api-proxy /usr/local/bin/docker-api-proxy # Run binary ENTRYPOINT ["docker-api-proxy"] # Default port EXPOSE 80