# ============================================================================= # s-file 信创文件安全传输系统 —— 本机 docker 部署(内网侧 + 外网侧两套) # # 启动: # docker build -f deploy/docker/Dockerfile.app -t sfile-app:local backend/target # docker build -f deploy/docker/Dockerfile.web -t sfile-web:local frontend # cd deploy && docker compose up -d # # 端口: # 内网前端 http://<本机IP>:28180 外网前端 http://<本机IP>:28280 # 其余(后端/postgres/redis/rabbitmq)只在容器网络内通信,不映射宿主机端口 # MeshSafe 复用本机已运行的 meshsafe-nginx:44380(两套后端都经 host.docker.internal 调用) # # 摆渡目录(模拟光闸): # gate/iw2ow = 内网 send + 外网 receive gate/ow2iw = 外网 send + 内网 receive # ============================================================================= name: sfile services: # ===================== 内网侧 ===================== web-iw: image: sfile-web:local container_name: sfile-iw-web restart: unless-stopped networks: [iw_net] ports: - "0.0.0.0:28180:80" volumes: - ./nginx/web-iw.conf:/etc/nginx/conf.d/default.conf:ro depends_on: app-iw: condition: service_healthy healthcheck: test: ["CMD-SHELL", "curl -sf -o /dev/null http://127.0.0.1:80/ || exit 1"] interval: 30s timeout: 5s retries: 3 app-iw: image: sfile-app:local container_name: sfile-iw-app restart: unless-stopped networks: iw_net: ipv4_address: 172.25.18.10 environment: TZ: Asia/Shanghai SPRING_CONFIG_ADDITIONAL_LOCATION: file:/config/application.yml CODE_SNOWFLAKE_WORKID_172_25_18_10: "1" volumes: - ./config/application-iw.yml:/config/application.yml:ro - ${SFILE_DATA:-D:/zcodedata/sfile}/iw/upload:/data/upload - ${SFILE_DATA:-D:/zcodedata/sfile}/iw/logs:/app/logs - ${SFILE_DATA:-D:/zcodedata/sfile}/gate/iw2ow:/data/transfer/send - ${SFILE_DATA:-D:/zcodedata/sfile}/gate/ow2iw:/data/transfer/receive extra_hosts: - "host.docker.internal:host-gateway" depends_on: pg-iw: condition: service_healthy redis-iw: condition: service_healthy mq-iw: condition: service_healthy healthcheck: test: ["CMD-SHELL", "curl -s --max-time 5 -o /dev/null http://127.0.0.1:8080/ || exit 1"] interval: 30s timeout: 8s retries: 5 start_period: 150s pg-iw: image: postgres:latest container_name: sfile-iw-pg restart: unless-stopped networks: [iw_net] environment: TZ: Asia/Shanghai POSTGRES_DB: s_file POSTGRES_USER: sfile POSTGRES_PASSWORD: sfile_iw_2026 volumes: # postgres:latest 为 18.x,数据目录挂载点已改为 /var/lib/postgresql - sfile-pgdata-iw:/var/lib/postgresql - ../backend/db/init-table-postgres-full.sql:/docker-entrypoint-initdb.d/01-init-table.sql:ro - ../backend/db/init-data.sql:/docker-entrypoint-initdb.d/02-init-data.sql:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U sfile -d s_file"] interval: 10s timeout: 5s retries: 10 start_period: 40s redis-iw: image: redis:latest container_name: sfile-iw-redis restart: unless-stopped networks: [iw_net] command: ["redis-server", "--appendonly", "yes", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"] volumes: - sfile-redis-iw:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 3s retries: 5 mq-iw: image: rabbitmq:3-management-alpine container_name: sfile-iw-mq restart: unless-stopped networks: [iw_net] environment: TZ: Asia/Shanghai RABBITMQ_DEFAULT_USER: sfile RABBITMQ_DEFAULT_PASS: sfile_mq_iw_2026 volumes: - sfile-mq-iw:/var/lib/rabbitmq healthcheck: test: ["CMD-SHELL", "rabbitmq-diagnostics -q ping"] interval: 20s timeout: 10s retries: 10 start_period: 40s # ===================== 外网侧 ===================== web-ow: image: sfile-web:local container_name: sfile-ow-web restart: unless-stopped networks: [ow_net] ports: - "0.0.0.0:28280:80" volumes: - ./nginx/web-ow.conf:/etc/nginx/conf.d/default.conf:ro depends_on: app-ow: condition: service_healthy healthcheck: test: ["CMD-SHELL", "curl -sf -o /dev/null http://127.0.0.1:80/ || exit 1"] interval: 30s timeout: 5s retries: 3 app-ow: image: sfile-app:local container_name: sfile-ow-app restart: unless-stopped networks: ow_net: ipv4_address: 172.25.28.10 environment: TZ: Asia/Shanghai SPRING_CONFIG_ADDITIONAL_LOCATION: file:/config/application.yml CODE_SNOWFLAKE_WORKID_172_25_28_10: "2" volumes: - ./config/application-ow.yml:/config/application.yml:ro - ${SFILE_DATA:-D:/zcodedata/sfile}/ow/upload:/data/upload - ${SFILE_DATA:-D:/zcodedata/sfile}/ow/logs:/app/logs - ${SFILE_DATA:-D:/zcodedata/sfile}/gate/ow2iw:/data/transfer/send - ${SFILE_DATA:-D:/zcodedata/sfile}/gate/iw2ow:/data/transfer/receive extra_hosts: - "host.docker.internal:host-gateway" depends_on: pg-ow: condition: service_healthy redis-ow: condition: service_healthy mq-ow: condition: service_healthy healthcheck: test: ["CMD-SHELL", "curl -s --max-time 5 -o /dev/null http://127.0.0.1:8080/ || exit 1"] interval: 30s timeout: 8s retries: 5 start_period: 150s pg-ow: image: postgres:latest container_name: sfile-ow-pg restart: unless-stopped networks: [ow_net] environment: TZ: Asia/Shanghai POSTGRES_DB: s_file POSTGRES_USER: sfile POSTGRES_PASSWORD: sfile_ow_2026 volumes: - sfile-pgdata-ow:/var/lib/postgresql - ../backend/db/init-table-postgres-full.sql:/docker-entrypoint-initdb.d/01-init-table.sql:ro - ../backend/db/init-data.sql:/docker-entrypoint-initdb.d/02-init-data.sql:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U sfile -d s_file"] interval: 10s timeout: 5s retries: 10 start_period: 40s redis-ow: image: redis:latest container_name: sfile-ow-redis restart: unless-stopped networks: [ow_net] command: ["redis-server", "--appendonly", "yes", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"] volumes: - sfile-redis-ow:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 3s retries: 5 mq-ow: image: rabbitmq:3-management-alpine container_name: sfile-ow-mq restart: unless-stopped networks: [ow_net] environment: TZ: Asia/Shanghai RABBITMQ_DEFAULT_USER: sfile RABBITMQ_DEFAULT_PASS: sfile_mq_ow_2026 volumes: - sfile-mq-ow:/var/lib/rabbitmq healthcheck: test: ["CMD-SHELL", "rabbitmq-diagnostics -q ping"] interval: 20s timeout: 10s retries: 10 start_period: 40s networks: iw_net: driver: bridge ipam: config: - subnet: 172.25.18.0/24 gateway: 172.25.18.1 ow_net: driver: bridge ipam: config: - subnet: 172.25.28.0/24 gateway: 172.25.28.1 volumes: sfile-pgdata-iw: sfile-redis-iw: sfile-mq-iw: sfile-pgdata-ow: sfile-redis-ow: sfile-mq-ow: