taibai_shopping/docker/docker-compose.yml
superlishunqin 170db69eb4 version_1
2025-07-14 05:06:05 +08:00

57 lines
1.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
services:
app:
build:
context: ..
dockerfile: docker/Dockerfile
restart: always
ports:
- "50400:50400"
depends_on:
- db
environment:
# 应用配置
- FLASK_CONFIG=production
- SECRET_KEY=change-me-in-production
# 数据库配置 - 两种选择之一:
# 选项1使用Docker内置MySQL取消下面的注释启用
# - MYSQL_HOST=db
# - MYSQL_USER=taibai
# - MYSQL_PASSWORD=taibaishopping
# - MYSQL_DB=shopping_db
# - MYSQL_PORT=3306
# 选项2使用现有外部数据库默认
# 保持上面的选项1注释即可使用配置文件中的默认设置
volumes:
- ../logs:/app/logs
- ../app/static/uploads:/app/app/static/uploads
networks:
- app-network
db:
image: mysql:8.0
restart: always
environment:
- MYSQL_DATABASE=online_shopping
- MYSQL_USER=taibai
- MYSQL_PASSWORD=taibaishopping
- MYSQL_ROOT_PASSWORD=root_password_here
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3366:3306" # 使用3366避免与主机MySQL端口冲突
networks:
- app-network
command: --default-authentication-plugin=mysql_native_password
networks:
app-network:
driver: bridge
volumes:
mysql-data: