mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-06 20:42:52 +08:00
Docker 优化: - Dockerfile 层缓存(requirements/lockfile 先复制再安装) - ARG 可配置镜像源,国际用户可覆盖为默认源 - 前端 Dockerfile 改用 corepack + frozen-lockfile - 精简 .dockerignore,排除 .git 和 Tauri 构建产物 CI/CD 优化: - docker-build 自动推送到 GHCR,支持 amd64/arm64 双架构 - 桌面端 CI 增加 pip/pnpm/cargo 缓存,升级 actions 版本 - Python 版本对齐为 3.11,增加 Linux 构建矩阵 - build.sh 加 -y 覆盖标志 文档更新: - README Docker 部署简化为 docker pull + docker run Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
1.3 KiB
YAML
55 lines
1.3 KiB
YAML
|
|
services:
|
|
backend:
|
|
container_name: bilinote-backend
|
|
build:
|
|
context: .
|
|
dockerfile: backend/Dockerfile
|
|
args:
|
|
APT_MIRROR: ${APT_MIRROR:-mirrors.tuna.tsinghua.edu.cn}
|
|
PIP_INDEX: ${PIP_INDEX:-https://pypi.tuna.tsinghua.edu.cn/simple}
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- BACKEND_PORT=${BACKEND_PORT}
|
|
- BACKEND_HOST=${BACKEND_HOST}
|
|
volumes:
|
|
- ./backend:/app
|
|
expose:
|
|
- "${BACKEND_PORT}" # 不再对外暴露,用于 nginx 内部通信
|
|
restart: on-failure:3
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:${BACKEND_PORT}/api/sys_health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 15s
|
|
mem_limit: 4g
|
|
|
|
frontend:
|
|
container_name: bilinote-frontend
|
|
build:
|
|
context: .
|
|
dockerfile: BillNote_frontend/Dockerfile
|
|
env_file:
|
|
- .env
|
|
expose:
|
|
- "80" # 不暴露给宿主机,只供 nginx 访问
|
|
restart: on-failure:3
|
|
mem_limit: 512m
|
|
|
|
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:
|
|
condition: service_healthy
|
|
frontend:
|
|
condition: service_started
|
|
restart: on-failure:3
|
|
mem_limit: 256m
|