优化更新

This commit is contained in:
2026-09-13 23:01:19 +08:00
parent 0c67b3e8b5
commit 23bd737b82
88 changed files with 2214 additions and 2503 deletions
+11 -11
View File
@@ -12,7 +12,7 @@
## Dockerfile 详解
项目根目录 `Dockerfile` 完整内容:
`docker/Dockerfile` 完整内容:
```dockerfile
# 基础镜像:Python 3.11-slim
@@ -58,9 +58,9 @@ Dockerfile 将 `requirements.txt` 和源码分两步 COPY,利用 Docker 层缓
version: '3.7'
services:
flask_elevue: # 服务名称
image: flask_elevue # 镜像名称
container_name: flask_elevue # 容器名称
flask_naivevue: # 服务名称
image: flask_naivevue # 镜像名称
container_name: flask_naivevue # 容器名称
build: # 构建配置
context: ./ # 构建上下文路径
dockerfile: Dockerfile # Dockerfile 文件名
@@ -116,26 +116,26 @@ docker-compose build
docker-compose ps
# 查看日志
docker-compose logs -f flask_elevue
docker-compose logs -f flask_naivevue
# 停止服务
docker-compose down
# 重启服务
docker-compose restart flask_elevue
docker-compose restart flask_naivevue
# 进入容器
docker exec -it flask_elevue bash
docker exec -it flask_naivevue bash
```
### 查看容器资源
```bash
# 查看容器资源占用
docker stats flask_elevue
docker stats flask_naivevue
# 查看容器日志大小
docker inspect --format='{{.LogPath}}' flask_elevue
docker inspect --format='{{.LogPath}}' flask_naivevue
```
## 环境变量注入
@@ -187,7 +187,7 @@ logging:
```yaml
services:
flask_elevue:
flask_naivevue:
# ... 后端配置 ...
nginx:
@@ -199,7 +199,7 @@ services:
- ./nginx.conf:/etc/nginx/conf.d/default.conf # Nginx 配置文件
- ./dist:/usr/share/nginx/html # 前端构建产物
depends_on: # 依赖服务
- flask_elevue # 等待后端服务启动
- flask_naivevue # 等待后端服务启动
```
## 总结