#version: '3.9' name: surl networks: surl-network: external: false services: backend: container_name: surl_backend build: . restart: unless-stopped depends_on: redis: condition: service_healthy postgres: condition: service_healthy ports: - ${PORT_BINDING} networks: - surl-network environment: PROTOCOL: ${PROTOCOL} HOST: ${HOST} PORT: ${PORT} DB_HOST: surl_postgres DB_PORT: 5432 # 更改此处密码 DB_PASS: ${DB_PASS} REDIS_HOST: surl_redis # change this to your secret key or it will be generated #SECRET_KEY: ne09xhakcvoi13$>":<[]. healthcheck: test: ["CMD", "java", "-version"] interval: 30s timeout: 10s retries: 3 start_period: 5s redis: container_name: surl_redis image: redis:latest restart: unless-stopped networks: - surl-network volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 5 start_period: 5s postgres: container_name: surl_postgres image: postgres:latest restart: unless-stopped networks: - surl-network environment: # 更改此处密码 POSTGRES_PASSWORD: ${DB_PASS} PGDATA: /var/lib/postgresql/data/pgdata volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s retries: 5 start_period: 5s timeout: 5s volumes: redis_data: name: surl_redis_data postgres_data: name: surl_postgres_data