Files
mini/Dockerfile

58 lines
1.4 KiB
Docker

# God Mode (Valhalla) Dockerfile
# Optimized for "Insane Mode" (High Concurrency & Throughput)
# 1. Base Image
FROM node:20-alpine AS base
WORKDIR /app
# Install system utilities for performance tuning
RUN apk add --no-cache libc6-compat curl bash
# 2. Dependencies
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json* ./
# Install deps (Legacy Peer Deps for Astro ecosystem compatibility)
RUN npm install --legacy-peer-deps
# 3. Builder
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build the application
RUN npm run build
# 4. Runner (God Mode Runtime)
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=4321
# --- GOD MODE OPTIMIZATIONS ---
# 1. Memory: Allow up to 16GB RAM usage (Prevents GC thrashing on 100k items)
ENV NODE_OPTIONS="--max-old-space-size=16384"
# 2. Threadpool: Increase libuv pool for heavy database I/O (Default 4 -> 128)
ENV UV_THREADPOOL_SIZE=128
# 3. Timeouts: Increase default timeouts for long-running batch jobs
ENV HTTP_TIMEOUT=300000
ENV KEEP_ALIVE_TIMEOUT=300000
# Create dedicated runner user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 astro
# Copy artifacts
COPY --from=builder /app/dist ./dist
COPY --from=deps /app/node_modules ./node_modules
COPY package.json ./
# Security & Permissions
USER astro
# Expose Port
EXPOSE 4321
# Launch with optimized settings
CMD ["node", "./dist/server/entry.mjs"]