# 本地开发:仅起 postgres + redis,应用用 npm run start:dev 直连 # 起容器:docker compose up -d postgres redis 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;需要时用 profile: # docker compose --profile app up -d app: profiles: ["app"] build: context: . dockerfile: docker/Dockerfile container_name: wxmp-app restart: unless-stopped env_file: .env ports: - "3000:3000" depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: wxmp_pg_data: wxmp_redis_data: