feat(backend): 添加 Docker 部署配置
- Dockerfile:基于 node:20-alpine,包含 TypeScript 编译和 Prisma Client 生成步骤,对外暴露 3001 端口 - .env.example:提供环境变量模板,团队成员按此创建 .env 文件 (.env 本身含敏感信息,已加入 .gitignore 不提交)
This commit is contained in:
parent
f056bf72a2
commit
3a921250c3
6
reading-platform-backend/.env.example
Normal file
6
reading-platform-backend/.env.example
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
DATABASE_URL="file:/app/prisma/dev.db"
|
||||||
|
NODE_ENV=production
|
||||||
|
PORT=3001
|
||||||
|
JWT_SECRET="your-secret-key-here"
|
||||||
|
JWT_EXPIRES_IN="7d"
|
||||||
|
FRONTEND_URL="http://your-server-ip:8080"
|
||||||
9
reading-platform-backend/Dockerfile
Normal file
9
reading-platform-backend/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM node:20-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install --registry=https://registry.npmmirror.com
|
||||||
|
COPY . .
|
||||||
|
RUN npx tsc
|
||||||
|
RUN npx prisma generate
|
||||||
|
EXPOSE 3001
|
||||||
|
CMD ["node", "dist/src/main.js"]
|
||||||
Loading…
Reference in New Issue
Block a user