29 lines
1.1 KiB
Docker
29 lines
1.1 KiB
Docker
# ─── Stage 1: Build ──────────────────────────────────────────────────────────
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# VITE_API_BASE_URL is baked into the bundle at build time.
|
|
# Use a relative path so the image works with any hostname/IP — nginx
|
|
# running on the same host proxies /api/v1/* to the backend container.
|
|
ARG VITE_API_BASE_URL=/api/v1
|
|
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
|
|
|
COPY package.json package-lock.json ./
|
|
COPY apps/okr/frontend/package.json ./apps/okr/frontend/
|
|
COPY apps/okr/backend/package.json ./apps/okr/backend/
|
|
|
|
RUN npm ci -w @ainative-okr/frontend
|
|
|
|
COPY apps/okr/frontend ./apps/okr/frontend
|
|
|
|
RUN npm run build -w @ainative-okr/frontend
|
|
|
|
# ─── Stage 2: nginx runtime ──────────────────────────────────────────────────
|
|
FROM nginx:alpine AS runtime
|
|
|
|
COPY --from=builder /app/apps/okr/frontend/dist /usr/share/nginx/html
|
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|