2026-06-08 17:51:29 +07:00
|
|
|
# ---- Builder Stage ----
|
|
|
|
|
FROM node:22-alpine AS builder
|
2026-06-01 21:44:29 +07:00
|
|
|
|
2026-06-01 23:31:20 +07:00
|
|
|
ARG VITE_BE_API_URL
|
|
|
|
|
ARG VITE_BE_WS_URL
|
|
|
|
|
|
2026-06-01 21:44:29 +07:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install pnpm
|
|
|
|
|
RUN npm install -g pnpm
|
|
|
|
|
|
|
|
|
|
# Copy workspace files
|
|
|
|
|
COPY pnpm-workspace.yaml .
|
|
|
|
|
COPY pnpm-lock.yaml .
|
|
|
|
|
COPY package.json .
|
|
|
|
|
|
2026-06-02 23:31:12 +07:00
|
|
|
# Copy patches (pnpm patchedDependencies)
|
|
|
|
|
COPY patches ./patches
|
|
|
|
|
|
2026-06-01 22:47:47 +07:00
|
|
|
# Copy service
|
2026-06-01 21:44:29 +07:00
|
|
|
COPY services/frontend ./services/frontend
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
|
|
2026-06-01 23:31:20 +07:00
|
|
|
# Build frontend (env vars injected at build time)
|
|
|
|
|
RUN VITE_BE_API_URL=${VITE_BE_API_URL} VITE_BE_WS_URL=${VITE_BE_WS_URL} pnpm --filter './services/frontend' run build
|
2026-06-01 21:44:29 +07:00
|
|
|
|
2026-06-08 17:51:29 +07:00
|
|
|
# ---- Runner Stage ----
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
# Copy Nginx config
|
|
|
|
|
COPY infra/docker/nginx/nginx-frontend.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
|
|
# Copy built static files from builder stage
|
|
|
|
|
COPY --from=builder /app/services/frontend/dist /usr/share/nginx/html
|
|
|
|
|
|
2026-06-01 21:44:29 +07:00
|
|
|
EXPOSE 3000
|
|
|
|
|
|
2026-06-08 17:51:29 +07:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|