59 lines
1.4 KiB
YAML
59 lines
1.4 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
mysql:
|
||
|
|
image: mysql:8.0
|
||
|
|
ports:
|
||
|
|
- "3306:3306"
|
||
|
|
volumes:
|
||
|
|
- mysql_data:/var/lib/mysql
|
||
|
|
- ./mysql/init:/docker-entrypoint-initdb.d
|
||
|
|
environment:
|
||
|
|
- MYSQL_ROOT_PASSWORD=treasure_box_2024
|
||
|
|
- MYSQL_DATABASE=treasure_box_game
|
||
|
|
- MYSQL_USER=treasure_box
|
||
|
|
- MYSQL_PASSWORD=treasure_box_2024
|
||
|
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
redis:
|
||
|
|
image: redis:7-alpine
|
||
|
|
ports:
|
||
|
|
- "6379:6379"
|
||
|
|
volumes:
|
||
|
|
- redis_data:/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "redis-cli", "ping"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
backend:
|
||
|
|
build:
|
||
|
|
context: ./backend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
ports:
|
||
|
|
- "8000:8000"
|
||
|
|
depends_on:
|
||
|
|
mysql:
|
||
|
|
condition: service_healthy
|
||
|
|
redis:
|
||
|
|
condition: service_healthy
|
||
|
|
environment:
|
||
|
|
- DATABASE_URL=mysql+pymysql://root:treasure_box_2024@mysql:3306/treasure_box_game
|
||
|
|
- REDIS_HOST=redis
|
||
|
|
- REDIS_PORT=6379
|
||
|
|
volumes:
|
||
|
|
- ./backend:/app
|
||
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||
|
|
restart: unless-stopped
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
mysql_data:
|
||
|
|
redis_data:
|
||
|
|
|