新增两步独立 Docker 部署方案(czleilei240 环境): 步骤一 寄卖商城(integral-resell) - step1-integral/docker-compose.yml:redis(Alpine自建) + houtai(webman PHP8) + h5(Nginx) - houtai.Dockerfile:PHP 8.0 + 阿里云镜像源 + webman.bin entrypoint - h5.Dockerfile:Nginx + configs.js 环境变量动态重写 - redis.Dockerfile:Alpine + apk 构建,绕过 DockerHub 镜像源问题 - 宿主机 bind-mount:/www/wwwroot/leileiadmin.czchunfang.com(FTP可直接更新程序) 步骤二 积分商城(single-shop-22) - step2-single-shop/docker-compose.yml:redis + admin-api + front-api + admin-web + h5 - Java Dockerfiles:OpenJDK 17 + --add-opens Spring Boot 2.2.6 兼容 公共配置 - nginx/:四个域名宝塔 Nginx 反代配置(HTTP→HTTPS 301、SSL 终止) - scripts/:sync-to-server.sh / deploy-step1.sh / remote-up.sh - DOCKER_DEPLOY.md:完整部署文档 Co-authored-by: Cursor <cursoragent@cursor.com>
188 lines
5.9 KiB
YAML
188 lines
5.9 KiB
YAML
# =============================================================
|
||
# 寄卖商城 + 积分商城 前后端 Docker 编排
|
||
# - 不含 MER-2.2 多商户
|
||
# - 不含 MySQL(使用阿里云 RDS)
|
||
# - 包含独立 Redis(如需用外部 Redis,注释掉 redis 服务并修改 REDIS_HOST)
|
||
# =============================================================
|
||
|
||
name: integral-shop
|
||
|
||
x-common: &common
|
||
restart: unless-stopped
|
||
environment:
|
||
TZ: ${TZ:-Asia/Shanghai}
|
||
logging:
|
||
driver: json-file
|
||
options:
|
||
max-size: "20m"
|
||
max-file: "5"
|
||
|
||
networks:
|
||
inner:
|
||
driver: bridge
|
||
|
||
volumes:
|
||
redis-data:
|
||
integral-runtime:
|
||
integral-upload:
|
||
single-images:
|
||
single-logs:
|
||
|
||
services:
|
||
# ---------------- Redis ----------------
|
||
redis:
|
||
<<: *common
|
||
image: redis:6.2-alpine
|
||
container_name: integral-shop-redis
|
||
command: ["redis-server", "/etc/redis/redis.conf", "--requirepass", "${REDIS_PASSWORD}"]
|
||
volumes:
|
||
- ./redis/redis.conf:/etc/redis/redis.conf:ro
|
||
- redis-data:/data
|
||
networks: [inner]
|
||
# 仅当 REDIS_HOST_PORT 非空时暴露
|
||
ports:
|
||
- "${REDIS_HOST_PORT:-}:6379"
|
||
healthcheck:
|
||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||
interval: 10s
|
||
timeout: 3s
|
||
retries: 5
|
||
|
||
# ---------------- 积分商城:Webman 后端 ----------------
|
||
integral-houtai:
|
||
<<: *common
|
||
build:
|
||
context: ../../integral-resell/houtai
|
||
dockerfile: ../../deploy/docker/integral-resell/houtai.Dockerfile
|
||
image: integral-shop/integral-houtai:latest
|
||
container_name: integral-houtai
|
||
networks: [inner]
|
||
volumes:
|
||
# .env 由宿主机模板渲染挂入容器;编辑此文件即可改 DB / OSS / 短信
|
||
- ./integral-resell/.env:/app/.env:ro
|
||
- integral-runtime:/app/runtime
|
||
- integral-upload:/app/public/upload
|
||
depends_on:
|
||
redis:
|
||
condition: service_healthy
|
||
|
||
# ---------------- 积分商城:H5 静态站 ----------------
|
||
integral-h5:
|
||
<<: *common
|
||
build:
|
||
context: ../../integral-resell/h5
|
||
dockerfile: ../../deploy/docker/integral-resell/h5.Dockerfile
|
||
image: integral-shop/integral-h5:latest
|
||
container_name: integral-h5
|
||
networks: [inner]
|
||
environment:
|
||
TZ: ${TZ:-Asia/Shanghai}
|
||
# 这些会在 entrypoint 中被注入到 static/configs.js
|
||
INTEGRAL_TITLE: ${INTEGRAL_TITLE}
|
||
INTEGRAL_API_PUBLIC_URL: ${INTEGRAL_API_PUBLIC_URL}
|
||
INTEGRAL_IMG_PUBLIC_URL: ${INTEGRAL_IMG_PUBLIC_URL}
|
||
INTEGRAL_H5_PUBLIC_URL: ${INTEGRAL_H5_PUBLIC_URL}
|
||
INTEGRAL_SN_ID: ${INTEGRAL_SN_ID}
|
||
INTEGRAL_APP_STR: ${INTEGRAL_APP_STR}
|
||
INTEGRAL_CONTRACT_PAGE: ${INTEGRAL_CONTRACT_PAGE}
|
||
ports:
|
||
- "${INTEGRAL_H5_PORT:-18080}:80"
|
||
depends_on:
|
||
- integral-houtai
|
||
|
||
# ---------------- 寄卖商城:管理后台 API ----------------
|
||
single-admin-api:
|
||
<<: *common
|
||
build:
|
||
context: ../../single-shop-22/backend
|
||
dockerfile: ../../deploy/docker/single-shop/admin-api.Dockerfile
|
||
image: integral-shop/single-admin-api:latest
|
||
container_name: single-admin-api
|
||
networks: [inner]
|
||
environment:
|
||
TZ: ${TZ:-Asia/Shanghai}
|
||
JAVA_HEAP_OPTS: ${SINGLE_ADMIN_JAVA_OPTS:--Xms128m -Xmx256m}
|
||
SPRING_PROFILES_ACTIVE: docker
|
||
SERVER_PORT: "30032"
|
||
MYSQL_HOST: ${RDS_HOST}
|
||
MYSQL_PORT: ${RDS_PORT:-3306}
|
||
MYSQL_DATABASE: ${RDS_SINGLE_DB}
|
||
MYSQL_USERNAME: ${RDS_SINGLE_USER}
|
||
MYSQL_PASSWORD: ${RDS_SINGLE_PASS}
|
||
REDIS_HOST: redis
|
||
REDIS_PORT: "6379"
|
||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||
REDIS_DATABASE: ${REDIS_SINGLE_ADMIN_DB:-25}
|
||
SYNC_SOURCE_ID: ${SYNC_SOURCE_ID:-}
|
||
SYNC_TARGET_MER_ID: ${SYNC_TARGET_MER_ID:-0}
|
||
volumes:
|
||
- ./single-shop/application-docker.yml:/config/application-docker.yml:ro
|
||
- single-images:/usr/local/crmeb/crmebimage
|
||
- single-logs:/app/log
|
||
depends_on:
|
||
redis:
|
||
condition: service_healthy
|
||
|
||
# ---------------- 寄卖商城:用户端 API ----------------
|
||
single-front-api:
|
||
<<: *common
|
||
build:
|
||
context: ../../single-shop-22/backend
|
||
dockerfile: ../../deploy/docker/single-shop/front-api.Dockerfile
|
||
image: integral-shop/single-front-api:latest
|
||
container_name: single-front-api
|
||
networks: [inner]
|
||
environment:
|
||
TZ: ${TZ:-Asia/Shanghai}
|
||
JAVA_OPTS: ${SINGLE_FRONT_JAVA_OPTS:--Xms256m -Xmx768m}
|
||
SPRING_PROFILES_ACTIVE: docker
|
||
SERVER_PORT: "30031"
|
||
MYSQL_HOST: ${RDS_HOST}
|
||
MYSQL_PORT: ${RDS_PORT:-3306}
|
||
MYSQL_DATABASE: ${RDS_SINGLE_DB}
|
||
MYSQL_USERNAME: ${RDS_SINGLE_USER}
|
||
MYSQL_PASSWORD: ${RDS_SINGLE_PASS}
|
||
REDIS_HOST: redis
|
||
REDIS_PORT: "6379"
|
||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||
REDIS_DATABASE: ${REDIS_SINGLE_FRONT_DB:-26}
|
||
volumes:
|
||
- ./single-shop/application-docker.yml:/config/application-docker.yml:ro
|
||
- single-images:/usr/local/crmeb/crmebimage
|
||
- single-logs:/app/log
|
||
depends_on:
|
||
redis:
|
||
condition: service_healthy
|
||
|
||
# ---------------- 寄卖商城:管理后台 Web ----------------
|
||
single-admin-web:
|
||
<<: *common
|
||
build:
|
||
context: ../../single-shop-22/backend-adminend
|
||
dockerfile: ../../deploy/docker/single-shop/admin-web.Dockerfile
|
||
args:
|
||
VUE_APP_BASE_API: ${SINGLE_ADMIN_BASE_API:-}
|
||
image: integral-shop/single-admin-web:latest
|
||
container_name: single-admin-web
|
||
networks: [inner]
|
||
ports:
|
||
- "${SINGLE_ADMIN_WEB_PORT:-18081}:80"
|
||
depends_on:
|
||
- single-admin-api
|
||
|
||
# ---------------- 寄卖商城:用户端 H5 ----------------
|
||
single-h5:
|
||
<<: *common
|
||
build:
|
||
context: ../../single-shop-22/single_uniapp22miao
|
||
dockerfile: ../../deploy/docker/single-shop/h5.Dockerfile
|
||
args:
|
||
H5_API_DOMAIN: ${SINGLE_H5_DOMAIN:-}
|
||
image: integral-shop/single-h5:latest
|
||
container_name: single-h5
|
||
networks: [inner]
|
||
ports:
|
||
- "${SINGLE_H5_PORT:-18082}:80"
|
||
depends_on:
|
||
- single-front-api
|