22 lines
817 B
Docker
22 lines
817 B
Docker
# ── build stage: compile the Vite bundle inside Docker ──
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
# Vite inlines this at build time, so it is a build arg and not a runtime env
|
|
# var — changing it later means rebuilding the bundle, not restarting nginx.
|
|
#
|
|
# Relative on purpose. A bundle carrying no hostname serves from any domain and
|
|
# is same-origin with the API that nginx proxies at /api/, so the deployment
|
|
# never has a CORS origin to keep in sync.
|
|
ARG VITE_UDYAM_API_BASE_URL=/api/v1/udyam
|
|
ENV VITE_UDYAM_API_BASE_URL=$VITE_UDYAM_API_BASE_URL
|
|
RUN npm run build
|
|
|
|
# ── serve stage: nginx serving the static SPA on 5173 ──
|
|
FROM nginx:alpine
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
EXPOSE 5173
|