-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
46 lines (31 loc) · 848 Bytes
/
Dockerfile.api
File metadata and controls
46 lines (31 loc) · 848 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
46
# Lightweight API-only Dockerfile (no frontend, no Playwright)
# For api.stratint.com subdomain
# Build stage
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
# Copy go module files
COPY go.mod go.sum ./
RUN go mod download
# Copy backend source
COPY . .
# Build backend binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o api-server ./cmd/server
# Runtime stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/api-server ./server
# Copy migrations
COPY migrations ./migrations
# Run as non-root user
RUN addgroup -g 1000 stratint && \
adduser -D -u 1000 -G stratint stratint && \
chown -R stratint:stratint /app
USER stratint
# Expose port
ENV PORT=8080
EXPOSE 8080
# Start server
CMD ["./server"]