feat: initial commit with Nuxt 3 student management system
- Add Nuxt 3 + Prisma + SQLite full-stack setup - Add student CRUD API with batch import/export - Add stats dashboard with gender/class distribution - Add target community settings feature - Add Docker deployment support (Dockerfile + docker-compose) - Add README with development and deployment instructions
This commit is contained in:
54
Dockerfile
Normal file
54
Dockerfile
Normal file
@@ -0,0 +1,54 @@
|
||||
# 多阶段构建
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 安装构建依赖
|
||||
RUN apk add --no-cache openssl python3 make g++
|
||||
|
||||
# 先复制 Prisma schema
|
||||
COPY prisma ./prisma
|
||||
|
||||
# 复制 package 文件
|
||||
COPY package*.json ./
|
||||
|
||||
# 安装依赖
|
||||
RUN npm ci --ignore-scripts
|
||||
|
||||
# 生成 Prisma Client
|
||||
RUN npx prisma generate
|
||||
|
||||
# 复制源代码
|
||||
COPY . .
|
||||
|
||||
# 构建
|
||||
RUN npm run build
|
||||
|
||||
# 生产镜像
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 安装运行时依赖
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
# 创建数据目录
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
# 复制 node_modules
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# 复制 Prisma
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
|
||||
# 复制 package.json
|
||||
COPY --from=builder /app/package.json ./
|
||||
|
||||
# 复制构建产物
|
||||
COPY --from=builder /app/.output ./
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 3000
|
||||
|
||||
# 启动应用
|
||||
CMD ["node", "server/index.mjs"]
|
||||
Reference in New Issue
Block a user