chore(base): 同步dev关于Docker及.env 的配置

This commit is contained in:
2025-12-15 16:16:17 +08:00
parent e2d6a02860
commit 572b4c4a00
21 changed files with 11950 additions and 100 deletions

View File

@@ -14,7 +14,7 @@ services:
build:
context: ./docker/php
dockerfile: Dockerfile
container_name: ${PROJECT_NAME}_php
container_name: ${PROJECT_NAME}_${APP_ENV}_php
restart: always
extra_hosts:
- "host.docker.internal:host-gateway" # 支持主机名解析
@@ -49,18 +49,19 @@ services:
networks:
- sass-platform-net
labels:
- "com.docker.compose.project.working_dir=${PROJECT_NAME}"
- "com.docker.compose.project.working_dir=${PROJECT_NAME}_${APP_ENV}"
nginx:
build:
context: ./docker/nginx
dockerfile: Dockerfile
container_name: ${PROJECT_NAME}_nginx
container_name: ${PROJECT_NAME}_${APP_ENV}_nginx
restart: always
ports:
- "${NGINX_PORT:-80}:80"
- "${NGINX_SSL_PORT:-443}:443"
volumes:
# 挂载项目代码到 Nginx 容器中
- ./src:/var/www/html:rw
# 更新下载源列表以加速apt-get
- ./docker/debian/sources.list:/etc/apt/sources.list:ro
@@ -72,11 +73,11 @@ services:
networks:
- sass-platform-net
labels:
- "com.docker.compose.project.working_dir=${PROJECT_NAME}"
- "com.docker.compose.project.working_dir=${PROJECT_NAME}_${APP_ENV}"
db:
image: mysql:5.7.44
container_name: ${PROJECT_NAME}_mysql
container_name: ${PROJECT_NAME}_${APP_ENV}_mysql
environment:
<<: *shared-api-env
volumes:
@@ -93,12 +94,12 @@ services:
- --collation-server=utf8mb4_unicode_ci
- --innodb_buffer_pool_size=256M
labels:
- "com.docker.compose.project.working_dir=${PROJECT_NAME}"
- "com.docker.compose.project.working_dir=${PROJECT_NAME}_${APP_ENV}"
# Redis 服务(可选)
redis:
image: redis:8.2
container_name: ${PROJECT_NAME}_redis
container_name: ${PROJECT_NAME}_${APP_ENV}_redis
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:-luckyshop123!@#}
REDISCLI_AUTH: ${REDIS_PASSWORD:-luckyshop123!@#}
@@ -111,13 +112,32 @@ services:
- sass-platform-net
restart: unless-stopped
labels:
- "com.docker.compose.project.working_dir=${PROJECT_NAME}"
- "com.docker.compose.project.working_dir=${PROJECT_NAME}_${APP_ENV}"
volumes:
mysql_db_data:
name: ${PROJECT_NAME}_${APP_ENV}_mysql_db_data
driver: local
driver_opts:
type: none
o: bind
device: ./docker/mysql_db_data/${APP_ENV}
redis_data:
name: ${PROJECT_NAME}_${APP_ENV}_redis_data
driver: local
driver_opts:
type: none
o: bind
device: ./docker/redis_data/${APP_ENV}
xdebug_logs:
name: ${PROJECT_NAME}_${APP_ENV}_xdebug_logs
driver: local
driver_opts:
type: none
o: bind
device: ./docker/xdebug_logs/${APP_ENV}
networks:
sass-platform-net:
name: ${PROJECT_NAME}_${APP_ENV}_net
driver: bridge