-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (19 loc) · 992 Bytes
/
Dockerfile
File metadata and controls
27 lines (19 loc) · 992 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
# ── Build stage ──────────────────────────────────────────────────────────────
FROM golang:1.25-alpine AS builder
WORKDIR /src
# Download dependencies first (layer cache)
COPY go.mod go.sum ./
RUN go mod download
# Build the binary (pure Go, no CGo needed for modernc.org/sqlite)
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=docker" \
-o /snare ./cmd/snare
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM alpine:3.20
RUN apk add --no-cache ca-certificates wget && \
mkdir -p /data && chmod 700 /data
COPY --from=builder /snare /usr/local/bin/snare
VOLUME ["/data"]
EXPOSE 8080 443
ENTRYPOINT ["snare"]
CMD ["serve", "--port", "8080", "--db", "/data/snare.db"]