Compare commits

...

2 Commits

Author SHA1 Message Date
xuyong
f37bc9bdf5 tag backend image as superdreamfront:0.0.1
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 21:58:20 +08:00
xuyong
b5553c144c add MySQL container to docker-compose and fix backend container/image name
- Add mysql:8.0 service with health check and named volume for data persistence
- Backend depends_on db with service_healthy condition
- Override SD_DB_HOST=db so backend connects to MySQL container via Docker network
- Rename backend container and image to superdreamfront
- Update .env.example to note "db" host for docker-compose usage

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 21:56:55 +08:00
2 changed files with 29 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ SD_PORT=18000
# Database (MySQL)
SD_DB_TYPE=mysql
SD_DB_HOST=localhost
SD_DB_HOST=localhost # use "db" when running with docker-compose
SD_DB_PORT=3306
SD_DB_USER=root
SD_DB_PASSWORD=

View File

@@ -1,6 +1,25 @@
services:
db:
image: mysql:8.0
container_name: superdream-db
environment:
MYSQL_ROOT_PASSWORD: ${SD_DB_PASSWORD:-superdream}
MYSQL_DATABASE: ${SD_DB_NAME:-superdream}
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${SD_DB_PASSWORD:-superdream}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
backend:
container_name: superdream
container_name: superdreamfront
image: superdreamfront:0.0.1
build:
context: .
dockerfile: Dockerfile
@@ -10,4 +29,12 @@ services:
- ./data:/backend/data
env_file:
- .env
environment:
SD_DB_HOST: db
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
db_data: