forked from wardgate/wardgate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (30 loc) · 914 Bytes
/
Dockerfile
File metadata and controls
45 lines (30 loc) · 914 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
41
42
43
44
45
# Build stage
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Install ca-certificates for HTTPS
RUN apk add --no-cache ca-certificates
# Copy go mod files first for layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o wardgate ./cmd/wardgate
# Runtime stage
FROM alpine:3.21
WORKDIR /app
# Install ca-certificates for TLS connections to upstream services
RUN apk add --no-cache ca-certificates tzdata
# Create non-root user
RUN adduser -D -u 1000 wardgate
# Copy binary from builder
COPY --from=builder /app/wardgate /app/wardgate
# Copy presets
COPY --from=builder /app/presets /app/presets
# Default config location
VOLUME ["/app/config"]
# Switch to non-root user
USER wardgate
EXPOSE 8080
ENTRYPOINT ["/app/wardgate"]
CMD ["-config", "/app/config/config.yaml", "-env", "/app/config/.env"]