Files
GMW/infra/docker/Dockerfile.frontend
T

41 lines
903 B
Docker
Raw Normal View History

# ---- Builder Stage ----
FROM node:22-alpine AS builder
ARG VITE_BE_API_URL
ARG VITE_BE_WS_URL
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy workspace files
COPY pnpm-workspace.yaml .
COPY pnpm-lock.yaml .
COPY package.json .
# Copy patches (pnpm patchedDependencies)
COPY patches ./patches
# Copy service
COPY services/frontend ./services/frontend
# Install dependencies
RUN pnpm install --frozen-lockfile
# 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
# ---- 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
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]