392ce162dc
Aegis CI / lint-and-test (push) Has been cancelled
npm ci installs exact versions from package-lock.json with no implicit resolution, making builds fully reproducible and guaranteed to use the audited safe dependency versions.
46 lines
1.3 KiB
Docker
46 lines
1.3 KiB
Docker
# ── Development Stage ──────────────────────────────────────────────────────
|
|
FROM node:20-alpine AS development
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies — use ci for reproducible installs (exact lock file versions)
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Expose Vite dev server port
|
|
EXPOSE 5173
|
|
|
|
# Start dev server with host binding for Docker
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
|
|
|
|
|
# ── Build Stage ────────────────────────────────────────────────────────────
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
|
|
# ── Production Stage ───────────────────────────────────────────────────────
|
|
FROM nginx:alpine AS production
|
|
|
|
# Copy built files to nginx
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx config for SPA routing
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|