# 一键启动:docker compose up -d # 同时起 postgres + redis + app,app 启动前自动跑 prisma migrate deploy services: postgres: image: postgres:16-alpine container_name: wxmp-postgres restart: unless-stopped environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: wxmp ports: - "5432:5432" volumes: - wxmp_pg_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d wxmp"] interval: 5s timeout: 3s retries: 10 redis: image: redis:7-alpine container_name: wxmp-redis restart: unless-stopped ports: - "6379:6379" volumes: - wxmp_redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 10 app: build: context: . dockerfile: docker/Dockerfile container_name: wxmp-app restart: unless-stopped env_file: .env # 容器内用服务名连 db/redis,覆盖 .env 里的 localhost environment: DATABASE_URL: postgresql://postgres:postgres@postgres:5432/wxmp?schema=public REDIS_URL: redis://redis:6379 ports: - "3090:3090" depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: wxmp_pg_data: wxmp_redis_data: