-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (26 loc) · 788 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (26 loc) · 788 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
# Build stage
FROM golang:1.23-alpine AS builder
WORKDIR /app
COPY . .
# Restore dependencies
RUN go mod download
# Build API binary
RUN CGO_ENABLED=0 GOOS=linux go build -o main ./cmd/api
# Build Seeder binary
RUN CGO_ENABLED=0 GOOS=linux go build -o seeder ./cmd/seeder
# Run stage
FROM alpine:latest
# Install timezone data and certificates
RUN apk add --no-cache tzdata ca-certificates
# Ensure Go can find the timezone data
ENV ZONEINFO=/usr/share/zoneinfo
# Create a non-root user
RUN adduser -D frostbyte
USER frostbyte
WORKDIR /app
COPY --from=builder /app/main .
COPY --from=builder /app/seeder .
# NOTE: In production, mount .env, server.crt, and server.key using volumes.
# Do NOT copy them here to avoid baking secrets into the image.
EXPOSE 8080
CMD ["./main"]