FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install --legacy-peer-deps
# Copy all configuration files first
COPY vite.config.js ./
COPY tsconfig.json ./
COPY index.html ./
COPY vite-env.d.ts ./
COPY postcss.config.mjs ./
# Copy frontend source code
COPY src ./src
COPY public ./public
# Build production bundle
RUN npm run build
# Expose the frontend port
EXPOSE ${FRONTEND_PORT:-5173}
# Serve static files using built-in Vite preview
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "5173"]