# ─── Stage 1: Install dependencies ─────────────────────────────────────────── FROM oven/bun:1 AS deps WORKDIR /app COPY package.json bun.lock ./ RUN bun install --frozen-lockfile # ─── Stage 2: Build Next.js ────────────────────────────────────────────────── FROM oven/bun:1 AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN bun run build # ─── Stage 3: Production runner ────────────────────────────────────────────── FROM oven/bun:1-slim AS runner WORKDIR /app ENV NODE_ENV=production # Copy runtime dependencies COPY --from=builder /app/node_modules ./node_modules # Copy Next.js build output COPY --from=builder /app/.next ./.next COPY --from=builder /app/public ./public # Copy server entry point and all runtime source files COPY --from=builder /app/server.ts ./server.ts COPY --from=builder /app/lib ./lib COPY --from=builder /app/drizzle ./drizzle COPY --from=builder /app/tsconfig.json ./tsconfig.json COPY --from=builder /app/next.config.ts ./next.config.ts # Pre-create data directory (SQLite db + uploads land here) RUN mkdir -p /app/data EXPOSE 3000 # Volumes for persistent data # Mount your Minecraft server directory to /mc-server # Mount your backups directory to /backups VOLUME ["/app/data", "/mc-server", "/backups"] CMD ["bun", "--bun", "run", "server.ts"]