-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile.backend
More file actions
35 lines (25 loc) · 830 Bytes
/
Copy pathDockerfile.backend
File metadata and controls
35 lines (25 loc) · 830 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
# -------- Stage 1: Build --------
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build the backend binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gogent ./cmd/gogent
# -------- Stage 2: Runtime --------
FROM alpine:3.19
WORKDIR /app
# Copy the binary
COPY --from=builder /app/gogent /usr/local/bin/gogent
# Copy migrations directory
COPY --from=builder /app/migrations /app/migrations
# Copy system specs (functions/providers) so server can sync them at runtime
COPY --from=builder /app/system /app/system
# Optionally copy default env file (can be overridden by k8s env)
COPY config.example.env /app/config.env
ENV PORT=8080
EXPOSE 8080
CMD ["gogent", "--server"]