- Update docker-compose.yml with frontend service and healthchecks - Add frontend Dockerfile with dev and production stages - Add nginx.conf for production frontend serving - Add docker-compose.prod.yml for production deployment - Add .env.example with all configuration options - Add init scripts (init.sh, init.ps1) for easy setup
46 lines
1.2 KiB
Docker
46 lines
1.2 KiB
Docker
# ── Development Stage ──────────────────────────────────────────────────────
|
|
FROM node:20-alpine AS development
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# 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;"]
|