-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 909 Bytes
/
Dockerfile
File metadata and controls
40 lines (31 loc) · 909 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
# Multi-stage Dockerfile for Guildmaster server
# Builds the Go binary from ./cmd/server and produces a small runtime image
############################
# Builder image
############################
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /src
# Cache modules
COPY go.mod go.sum ./
RUN go mod download
# Copy full source
COPY . .
# Build the server binary. Disable CGO for a static binary.
WORKDIR /src/cmd/server
ENV CGO_ENABLED=0
RUN go build -o /out/guildmaster .
############################
# Final image
############################
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
# Copy binary and static assets
COPY --from=builder /out/guildmaster /app/guildmaster
COPY assets /app/assets
EXPOSE 8080
# Minimal, non-root user
RUN addgroup -S app && adduser -S app -G app
USER app
ENTRYPOINT ["/app/guildmaster"]