-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (29 loc) · 901 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.23.2
ARG ALPINE_VERSION=3.20
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
# Install dependencies
RUN apk --no-cache add --update make tzdata ca-certificates gcc musl-dev zstd-dev
# Create app directory
RUN mkdir /app
WORKDIR /app
# Copy Go modules files and download dependencies
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy selectively for better security
COPY cmd cmd
COPY internal internal
COPY templates templates
# Build binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix -ldflags="-s -w" \
-o ./rudder-load-producer \
cmd/producer/*.go
FROM alpine:${ALPINE_VERSION}
# Install dependencies
RUN apk --no-cache upgrade && \
apk --no-cache add tzdata curl bash zstd-libs
WORKDIR /
RUN mkdir templates
COPY --from=builder /app/templates templates
COPY --from=builder /app/rudder-load-producer .