Files
php-official-website/docker-compose.yml

36 lines
1.0 KiB
YAML

services:
php-fpm:
build:
context: ./docker/php
dockerfile: Dockerfile
container_name: ${PROJECT_NAME}_${APP_ENV}_php
restart: always
extra_hosts:
- "host.docker.internal:host-gateway" # 支持主机名解析
environment:
PHP_ENV: ${PHP_ENV:-dev}
APP_ENV: ${APP_ENV:-dev}
APP_DEBUG: ${APP_DEBUG:-true}
ports:
- "${PHP_FPM_PORT:-9000}:9000"
volumes:
- ./src:/var/www/html
# 更新下载源列表以加速apt-get
- ./docker/debian/sources.list:/etc/apt/sources.list:ro
- ./docker/php/php.ini:/usr/local/etc/php/php.ini:ro
healthcheck:
test: ["CMD", "bash", "-c", "curl -f http://localhost:9000/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- net-php-ooficial-website
labels:
- "com.docker.compose.project.working_dir=${PROJECT_NAME}_${APP_ENV}"
networks:
net-php-ooficial-website:
name: ${PROJECT_NAME}_${APP_ENV}_net
driver: bridge