-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
40 lines (31 loc) · 1.01 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
# Stage 1: Build admin frontend
FROM node:20-alpine AS admin-builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app/apps/admin
COPY apps/admin/package.json apps/admin/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY apps/admin/ .
RUN pnpm build
# Stage 2: Build Go server
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Build uses module in apps/server
WORKDIR /app/apps/server
COPY apps/server/go.mod .
COPY apps/server/go.sum .
RUN go mod download
WORKDIR /app
COPY . .
# Copy admin dist from previous stage
COPY --from=admin-builder /app/apps/admin/dist ./apps/admin/dist
# Build server binary by default (apps/server)
RUN CGO_ENABLED=0 GOOS=linux go build -tags weknora -o servify ./apps/server/cmd/server
# Stage 3: Runtime
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/servify .
COPY --from=builder /app/apps/admin/dist ./apps/admin/dist
# Config file can be mounted as ./config.yml at runtime
EXPOSE 8080
CMD ["./servify"]