优化更新
This commit is contained in:
@@ -58,9 +58,9 @@ Dockerfile 将 `requirements.txt` 和源码分两步 COPY,利用 Docker 层缓
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
fastapi_elevue: # 服务名称
|
||||
image: fastapi_elevue # 镜像名称
|
||||
container_name: fastapi_elevue # 容器名称
|
||||
fastapi_naivevue: # 服务名称
|
||||
image: fastapi_naivevue # 镜像名称
|
||||
container_name: fastapi_naivevue # 容器名称
|
||||
build: # 构建配置
|
||||
context: ./ # 构建上下文路径
|
||||
dockerfile: Dockerfile # Dockerfile 文件名
|
||||
@@ -116,26 +116,26 @@ docker-compose build
|
||||
docker-compose ps
|
||||
|
||||
# 查看日志
|
||||
docker-compose logs -f fastapi_elevue
|
||||
docker-compose logs -f fastapi_naivevue
|
||||
|
||||
# 停止服务
|
||||
docker-compose down
|
||||
|
||||
# 重启服务
|
||||
docker-compose restart fastapi_elevue
|
||||
docker-compose restart fastapi_naivevue
|
||||
|
||||
# 进入容器
|
||||
docker exec -it fastapi_elevue bash
|
||||
docker exec -it fastapi_naivevue bash
|
||||
```
|
||||
|
||||
### 查看容器资源
|
||||
|
||||
```bash
|
||||
# 查看容器资源占用
|
||||
docker stats fastapi_elevue
|
||||
docker stats fastapi_naivevue
|
||||
|
||||
# 查看容器日志大小
|
||||
docker inspect --format='{{.LogPath}}' fastapi_elevue
|
||||
docker inspect --format='{{.LogPath}}' fastapi_naivevue
|
||||
```
|
||||
|
||||
## 环境变量注入
|
||||
@@ -186,7 +186,7 @@ logging:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
fastapi_elevue:
|
||||
fastapi_naivevue:
|
||||
# ... 后端配置 ...
|
||||
|
||||
nginx:
|
||||
@@ -198,7 +198,7 @@ services:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf # Nginx 配置文件
|
||||
- ./dist:/usr/share/nginx/html # 前端构建产物
|
||||
depends_on: # 依赖服务
|
||||
- fastapi_elevue # 等待后端服务启动
|
||||
- fastapi_naivevue # 等待后端服务启动
|
||||
```
|
||||
|
||||
## 总结
|
||||
|
||||
Reference in New Issue
Block a user