services: db: image: postgres:18-alpine environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} ports: - "127.0.0.1:${DB_HOST_PORT:-5432}:5432" volumes: - pgdata:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 3s retries: 5 start_period: 10s restart: unless-stopped app: build: context: ./docker/php network: host # РКН блочит DNS, поэтому свой резолвер args: UID: ${UID:-1000} GID: ${GID:-1000} user: "${UID:-1000}:${GID:-1000}" command: php -S 0.0.0.0:8080 -t public public/router.php working_dir: /var/www/html environment: DB_HOST: db DB_PORT: "5432" DB_NAME: ${POSTGRES_DB} DB_USER: ${POSTGRES_USER} DB_PASSWORD: ${POSTGRES_PASSWORD} volumes: - ./app:/var/www/html - ./docker/php/php.ini:/usr/local/etc/php/conf.d/zz-dev.ini:ro ports: - "127.0.0.1:${APP_PORT:-8080}:8080" depends_on: db: condition: service_healthy healthcheck: test: ["CMD", "php", "-r", "exit(@file_get_contents('http://127.0.0.1:8080/') === false ? 1 : 0);"] interval: 10s timeout: 3s retries: 5 start_period: 15s restart: unless-stopped volumes: pgdata: