46 lines
1.1 KiB
Docker
46 lines
1.1 KiB
Docker
# ============================================
|
|
# SIMRS Log Forensic Inspector — PRODUCTION
|
|
# ============================================
|
|
# Mode: Multi-stage build, optimized image
|
|
# Frontend: Static bundle baked into image
|
|
# Server: Node.js tanpa devDependencies
|
|
# ============================================
|
|
|
|
# --- Stage 1: Build frontend ---
|
|
FROM node:23-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- Stage 2: Production runtime ---
|
|
FROM node:23-alpine AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Install production dependencies only
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev && npm cache clean --force
|
|
|
|
# Copy built frontend bundle
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Copy server source code only
|
|
COPY server ./server
|
|
|
|
EXPOSE 5880
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=5880
|
|
|
|
# Healthcheck: cek endpoint utama
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:5880/ || exit 1
|
|
|
|
# Jalankan server langsung tanpa --watch
|
|
CMD ["node", "server/index.js"]
|