-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.websrv
More file actions
53 lines (42 loc) · 1.19 KB
/
Dockerfile.websrv
File metadata and controls
53 lines (42 loc) · 1.19 KB
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
46
47
48
49
50
51
52
53
# docker build -t registryext.bsprague.com/codenames -f Dockerfile.websrv .
FROM golang:1.25.4 AS builder
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid 65532 \
noroot
WORKDIR /build
# Copy dependency files first for caching
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# Copy the rest of the source code
COPY cmd/codenames-server/ cmd/codenames-server/
COPY aiclient/ aiclient/
COPY boardgen/ boardgen/
COPY codenames/ codenames/
COPY consensus/ consensus/
COPY cryptorand/ cryptorand/
COPY dict/ dict/
COPY game/ game/
COPY httperr/ httperr/
COPY hub/ hub/
COPY msgs/ msgs/
COPY sqldb/ sqldb/
COPY web/ web/
# Build the binary (statically linked)
RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/codenames-server
FROM scratch
WORKDIR /app
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
# Copy the binary
COPY --from=builder /server /server
# Expose the port the app runs on
EXPOSE 8080
# Run the binary
ENTRYPOINT ["/server"]