Compare commits
5 Commits
2c67204ef7
...
5e0c87768c
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e0c87768c | |||
| 0b3998489d | |||
| 92071e5ba6 | |||
| 3a921250c3 | |||
| f056bf72a2 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -19,7 +19,8 @@ target/
|
||||
# 环境变量(含敏感信息,不提交)
|
||||
.env
|
||||
.env.local
|
||||
.env.production
|
||||
# .env.production 只含 API 地址,允许提交
|
||||
# .env.production
|
||||
|
||||
# 保留开发环境配置(可按需注释掉)
|
||||
# .env.development
|
||||
|
||||
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: ./reading-platform-backend
|
||||
container_name: kindergarten-backend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3001:3001"
|
||||
environment:
|
||||
- PORT=3001
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=file:/app/prisma/dev.db
|
||||
- JWT_SECRET=${JWT_SECRET:-change-this-secret}
|
||||
- JWT_EXPIRES_IN=7d
|
||||
- FRONTEND_URL=http://localhost:8080
|
||||
- PRISMA_QUERY_ENGINE_LIBRARY=/app/node_modules/.prisma/client/libquery_engine-linux-musl-openssl-3.0.x.so.node
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./reading-platform-frontend
|
||||
container_name: kindergarten-frontend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80"
|
||||
depends_on:
|
||||
- backend
|
||||
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"]
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
|
||||
3
reading-platform-frontend/.env.production
Normal file
3
reading-platform-frontend/.env.production
Normal file
@ -0,0 +1,3 @@
|
||||
VITE_API_BASE_URL=http://8.148.151.56:3001/api/v1
|
||||
VITE_SERVER_BASE_URL=http://8.148.151.56:3001
|
||||
VITE_APP_TITLE=幼儿阅读教学服务平台
|
||||
14
reading-platform-frontend/Dockerfile
Normal file
14
reading-platform-frontend/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
# 阶段一:编译
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install --registry=https://registry.npmmirror.com
|
||||
COPY . .
|
||||
RUN npx vite build
|
||||
|
||||
# 阶段二:Nginx 服务
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
21
reading-platform-frontend/nginx.conf
Normal file
21
reading-platform-frontend/nginx.conf
Normal file
@ -0,0 +1,21 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Vue Router history 模式支持
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 反向代理后端 API
|
||||
location /api/ {
|
||||
proxy_pass http://backend:3001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
location /uploads/ {
|
||||
proxy_pass http://backend:3001;
|
||||
}
|
||||
}
|
||||
7
reading-platform-frontend/package-lock.json
generated
7
reading-platform-frontend/package-lock.json
generated
@ -555,7 +555,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.20.tgz",
|
||||
"integrity": "sha512-1cukXLlePFiJ8YKXn/4tMKsy0etxYLCkXk8nUCFi11nRONF2Ba2CD5b21/ovtOO2tL6afTJfwmc1ed3HG7eB1g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"preact": "~10.12.1"
|
||||
}
|
||||
@ -1367,7 +1366,6 @@
|
||||
"integrity": "sha512-Rs1bVAIdBs5gbTIKza/tgpMuG1k3U/UMJLWecIMxNdJFDMzcM5LOiLVRYh3PilWEYDIeUDv7bpiHPLPsbydGcw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~6.21.0"
|
||||
}
|
||||
@ -2875,7 +2873,6 @@
|
||||
"integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
},
|
||||
@ -2977,7 +2974,6 @@
|
||||
"integrity": "sha512-eKzFy13Nk+IRHhlAwP3sfuv+PzOrvzUkwJK2hdoCKYcWGSdmwFpeGpWmyewdw8EgBnsKaSBtgf/0b2K635ecSA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.5.0",
|
||||
"colorjs.io": "^0.5.0",
|
||||
@ -3489,7 +3485,6 @@
|
||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@ -3705,7 +3700,6 @@
|
||||
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.43",
|
||||
@ -3787,7 +3781,6 @@
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.28.tgz",
|
||||
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.28",
|
||||
"@vue/compiler-sfc": "3.5.28",
|
||||
|
||||
@ -71,8 +71,6 @@ declare module 'vue' {
|
||||
ATabs: typeof import('ant-design-vue/es')['Tabs']
|
||||
ATag: typeof import('ant-design-vue/es')['Tag']
|
||||
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||
ATimeline: typeof import('ant-design-vue/es')['Timeline']
|
||||
ATimelineItem: typeof import('ant-design-vue/es')['TimelineItem']
|
||||
ATimeRangePicker: typeof import('ant-design-vue/es')['TimeRangePicker']
|
||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||
ATypographyText: typeof import('ant-design-vue/es')['TypographyText']
|
||||
|
||||
Loading…
Reference in New Issue
Block a user