-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (24 loc) · 727 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (24 loc) · 727 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
# Stage 1: Build frontend
FROM node:22-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npx vite build
# Stage 2: Build backend
FROM golang:1.25-alpine AS backend-build
WORKDIR /app/backend
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /threelab-server .
# Stage 3: Production image
FROM alpine:3.21
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=backend-build /threelab-server ./threelab-server
COPY --from=frontend-build /app/frontend/dist ./static
ENV THREELAB_PORT=8080
ENV THREELAB_STATIC_DIR=/app/static
EXPOSE 8080
CMD ["./threelab-server"]