- 新增 deploy/docker/:Docker 本机模拟部署,含 Dockerfile、docker-compose、deploy.sh 一键脚本 - 新增 deploy/remote/:远程服务器部署,含 SSH 自动上传、重启、回滚脚本 - 新增 deploy/README.md:完整使用手册,含现状分析、落地调整工作清单、命令速查 - 新增 build.sh/start.sh:本地构建和启动脚本(含飞书通知) - 新增前端 .env.docker 环境配置,API 指向测试服务器 - 前端 package.json 新增 build-docker 命令 - 更新 .gitignore:排除 IDE 配置、SQL 数据、Docker 敏感文件 - 前端 UI 样式优化(多个页面组件) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
111 lines
3.0 KiB
YAML
111 lines
3.0 KiB
YAML
services:
|
||
# ==================== 基础设施(可选,默认使用宿主机 MySQL/Redis)====================
|
||
# 如需独立数据库,取消注释以下 mysql 和 redis 服务
|
||
# mysql:
|
||
# image: mysql:5.7
|
||
# platform: linux/amd64
|
||
# container_name: smartclean-mysql
|
||
# ports:
|
||
# - "${MYSQL_PORT:-3307}:3306"
|
||
# environment:
|
||
# MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-kaixinjiuhao}
|
||
# volumes:
|
||
# - mysql_data:/var/lib/mysql
|
||
# - ./init-sql:/docker-entrypoint-initdb.d
|
||
# - ../../sql:/sql-source
|
||
# command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||
# healthcheck:
|
||
# test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||
# interval: 10s
|
||
# timeout: 5s
|
||
# retries: 10
|
||
# start_period: 30s
|
||
# networks:
|
||
# - smartclean
|
||
|
||
# redis:
|
||
# image: redis:6-alpine
|
||
# container_name: smartclean-redis
|
||
# ports:
|
||
# - "${REDIS_PORT:-6380}:6379"
|
||
# command: redis-server --requirepass ${REDIS_PASSWORD:-kaixinjiuhao}
|
||
# volumes:
|
||
# - redis_data:/data
|
||
# healthcheck:
|
||
# test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-kaixinjiuhao}", "ping"]
|
||
# interval: 10s
|
||
# retries: 3
|
||
# networks:
|
||
# - smartclean
|
||
|
||
# ==================== 应用服务 ====================
|
||
web:
|
||
image: smartclean-web:${VERSION:-latest}
|
||
container_name: smartclean-web
|
||
build:
|
||
context: ../..
|
||
dockerfile: deploy/docker/Dockerfile.web
|
||
ports:
|
||
- "${WEB_PORT:-18095}:8080"
|
||
extra_hosts:
|
||
- "host.docker.internal:host-gateway"
|
||
volumes:
|
||
- ./conf/application-docker.yml:/app/config/application-docker.yml
|
||
- web_logs:/app/logs
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-sf", "http://localhost:8080/"]
|
||
interval: 15s
|
||
timeout: 5s
|
||
retries: 5
|
||
start_period: 90s
|
||
restart: on-failure:3
|
||
networks:
|
||
- smartclean
|
||
|
||
task:
|
||
image: smartclean-task:${VERSION:-latest}
|
||
container_name: smartclean-task
|
||
build:
|
||
context: ../..
|
||
dockerfile: deploy/docker/Dockerfile.task
|
||
ports:
|
||
- "${TASK_PORT:-18097}:8097"
|
||
extra_hosts:
|
||
- "host.docker.internal:host-gateway"
|
||
environment:
|
||
SPRING_PROFILES_ACTIVE: docker
|
||
volumes:
|
||
- ./conf/application-task-docker.yml:/app/config/application-task-docker.yml
|
||
- task_logs:/app/logs
|
||
restart: on-failure:3
|
||
networks:
|
||
- smartclean
|
||
|
||
frontend:
|
||
image: smartclean-front:${VERSION:-latest}
|
||
container_name: smartclean-front
|
||
build:
|
||
context: ../..
|
||
dockerfile: deploy/docker/Dockerfile.front
|
||
ports:
|
||
- "${FRONT_PORT:-8180}:80"
|
||
depends_on:
|
||
- web
|
||
volumes:
|
||
- ./conf/nginx.conf:/etc/nginx/conf.d/default.conf
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-sf", "http://localhost/"]
|
||
interval: 10s
|
||
retries: 3
|
||
restart: on-failure:3
|
||
networks:
|
||
- smartclean
|
||
|
||
volumes:
|
||
web_logs:
|
||
task_logs:
|
||
|
||
networks:
|
||
smartclean:
|
||
driver: bridge
|