Files
BiliNote/docker-compose.yml
黄建武 3862c657b7 build(docker): 更新 docker-compose配置
- 将 Nginx 容器的端口映射改为使用环境变量 APP_PORT- 移除 frontend 服务的依赖
2025-05-12 16:13:05 +08:00

38 lines
823 B
YAML

services:
backend:
container_name: bilinote-backend
build:
context: .
dockerfile: backend/Dockerfile
env_file:
- .env
environment:
- BACKEND_PORT=${BACKEND_PORT}
- BACKEND_HOST=${BACKEND_HOST}
volumes:
- ./backend:/app
expose:
- "${BACKEND_PORT}" # 不再对外暴露,用于 nginx 内部通信
frontend:
container_name: bilinote-frontend
build:
context: .
dockerfile: BillNote_frontend/Dockerfile
env_file:
- .env
expose:
- "80" # 不暴露给宿主机,只供 nginx 访问
nginx:
container_name: bilinote-nginx
image: nginx:1.25-alpine
ports:
- "${APP_PORT}:80"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- backend
- frontend