2022-03-30 20:13:51 -04:00
|
|
|
FROM golang:alpine AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
2025-02-05 23:08:50 +03:00
|
|
|
# Copy go mod and project files
|
2025-02-17 11:20:15 +00:00
|
|
|
COPY go.* ./
|
2025-02-05 23:08:50 +03:00
|
|
|
RUN go mod download
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
# Install necessary dependencies
|
|
|
|
|
RUN apk update && apk add --no-cache git ca-certificates openssl && update-ca-certificates
|
|
|
|
|
|
|
|
|
|
# Build the binary
|
|
|
|
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o ./dlrouter ./cmd/main.go
|
2022-03-30 20:13:51 -04:00
|
|
|
|
2025-02-05 23:08:50 +03:00
|
|
|
FROM gcr.io/distroless/static:nonroot
|
|
|
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
2022-03-30 20:13:51 -04:00
|
|
|
|
2025-02-05 23:08:50 +03:00
|
|
|
# Copy the binary from the builder stage
|
|
|
|
|
COPY --from=builder /src/dlrouter /bin/dlrouter
|
2022-03-30 20:43:10 -04:00
|
|
|
|
2025-02-05 23:08:50 +03:00
|
|
|
CMD ["/bin/dlrouter"]
|