feat: 添加Docker部署配置和文档

- 创建docker-compose.yml多容器编排配置
- 创建Dockerfile多阶段构建配置
- 创建nginx.conf反向代理和SSL配置
- 创建.env.example环境变量示例文件
- 创建setup-ssl.sh SSL证书配置脚本
- 创建deploy.sh自动化部署脚本
- 创建DEPLOYMENT.md详细部署文档
- 配置容器名称为novalon-website,版本1.0.0
- 配置端口映射80和443
- 配置Let's Encrypt免费SSL证书
- 配置域名novalon.cn,服务器IP 139.155.109.62
- 配置ICP备案号:蜀ICP备2026013658号
This commit is contained in:
张翔
2026-03-26 19:27:18 +08:00
parent b26cf5b451
commit ece3c86e29
7 changed files with 799 additions and 180 deletions
+1 -15
View File
@@ -1,6 +1,5 @@
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
@@ -8,7 +7,6 @@ WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
@@ -18,7 +16,6 @@ ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
@@ -29,20 +26,9 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Create necessary directories
RUN mkdir -p /app/data /app/uploads
RUN chown -R nextjs:nodejs /app/data /app/uploads
USER nextjs
EXPOSE 3000
@@ -50,4 +36,4 @@ EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]
CMD ["node", "server.js"]