Dominion/Dockerfile
2026-08-07 21:08:59 +05:00

47 lines
1.4 KiB
Docker

# ==============================================================================
# Multi-stage Dockerfile for Coolify & Containerized Environments
# ==============================================================================
# ------------------------------------------------------------------------------
# Stage 1: Build Stage
# ------------------------------------------------------------------------------
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package manifests
COPY package*.json ./
# Install dependencies needed for vite & esbuild build
RUN npm install
# Copy full application source code
COPY . .
# Run production build (vite client build + esbuild server compilation)
RUN npm run build
# ------------------------------------------------------------------------------
# Stage 2: Production Runner Stage
# ------------------------------------------------------------------------------
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV DATA_PATH=/app/data/portal-data.json
# Copy package manifests
COPY package*.json ./
# Install production dependencies only
RUN npm install --omit=dev && npm cache clean --force
# Copy compiled distribution output from builder stage
COPY --from=builder /app/dist ./dist
# Create persistent data directory
RUN mkdir -p /app/data
# Start production application server
CMD ["node", "dist/server.cjs"]