-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 830 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 830 Bytes
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
39
40
# ============================
# Builder stage
# ============================
FROM golang:1.25-alpine AS builder
# Set working directory
WORKDIR /app
# Install minimal dependencies
RUN apk add --no-cache git ca-certificates
# Copy go mod files and download deps
COPY go.mod go.sum ./
RUN go mod download
# Copy full source
COPY . .
# Build static binary (Buildx will inject TARGETOS and TARGETARCH)
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags='-w -s -extldflags "-static"' \
-o indexer ./cmd/indexer/main.go
# ============================
# Runtime stage
# ============================
FROM gcr.io/distroless/cc-debian12
WORKDIR /app
COPY --from=builder /app/indexer /app/indexer
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/app/indexer"]
CMD ["index"]