Files
forumlify/dockerfile
T
lezi-fun 281460fb03 feat: migrate to Next.js 14 (App Router + Route Handlers)
- Replace Express server with Next.js Route Handlers (16 API routes)
- Rewrite index.html SPA as React components (feed, post, admin, modals)
- Move style.css to app/globals.css with dark/light themes intact
- Add lib/db.js, lib/auth.js (JWT), lib/api.js (client API wrapper)
- Server binds 0.0.0.0 by default; host/port configurable via config.js
- Uploads served via /api/uploads route (rewrite keeps /uploads/ URLs)
- Multi-stage dockerfile using standalone output
2026-08-09 17:02:11 +08:00

32 lines
756 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# Forumlify (Next.js) 生产镜像 — standalone 模式
# ============================================================
# ---- 构建阶段 ----
FROM node:18-alpine AS builder
WORKDIR /app
# 先装依赖(利用缓存)
COPY package.json package-lock.json* bun.lock* ./
RUN npm install
# 复制源码并构建
COPY . .
RUN npm run build
# ---- 运行阶段 ----
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# standalone 输出(含 server.js 与最小 node_modules)
COPY --from=builder /app/.next/standalone ./
# 静态资源
COPY --from=builder /app/.next/static ./.next/static
# 上传目录
RUN mkdir -p /app/uploads
EXPOSE 3000
CMD ["node", "server.js"]