-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 730 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (21 loc) · 730 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
# Stage 1: The Builder
FROM golang:1.25-alpine AS builder
WORKDIR /app
# 1. Copy ONLY the dependency locks first
COPY go.mod go.sum ./
# 2. Download dependencies (Docker will heavily cache this layer unless go.mod changes)
RUN go mod download
# 3. Copy the rest of the source code
COPY . .
# 4. Compile the static binary
RUN CGO_ENABLED=0 GOOS=linux go build -o sentinelsol-daemon ./cmd/sentinelsol
# Stage 2: The Production Image (Ultra lightweight)
FROM alpine:latest
WORKDIR /app
# Copy ONLY the compiled binary from the builder stage
COPY --from=builder /app/sentinelsol-daemon .
# Expose the Prometheus metrics port and the pprof diagnostic port
EXPOSE 8080
EXPOSE 6060
# Run the daemon
CMD ["./sentinelsol-daemon"]