2025-03-25 17:40:13 +08:00
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
|
|
php:
|
|
|
|
image: php:7.3-fpm
|
|
|
|
volumes:
|
|
|
|
- /data/laravel_test:/var/www/html
|
|
|
|
working_dir: /var/www/html
|
|
|
|
networks:
|
|
|
|
- laravel_net
|
2025-03-26 20:45:53 +08:00
|
|
|
# 修正后的启动命令
|
|
|
|
command: >
|
2025-03-27 10:22:03 +08:00
|
|
|
sh -c "tee /etc/apt/sources.list <<EOF
|
|
|
|
# 清华大学 Debian 11 Bullseye 镜像
|
|
|
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
|
|
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
|
|
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
|
|
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
|
|
|
EOF
|
|
|
|
&& set -ex
|
2025-03-26 20:45:53 +08:00
|
|
|
&& apt-get update
|
|
|
|
&& apt-get install -y libzip-dev unzip
|
|
|
|
&& docker-php-ext-install pdo_mysql zip
|
|
|
|
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
&& composer install --no-dev --optimize-autoloader
|
|
|
|
&& php-fpm"
|
2025-03-26 21:34:01 +08:00
|
|
|
# 添加健康检查
|
|
|
|
healthcheck:
|
|
|
|
test: ["CMD", "test", "-f", "/var/www/html/vendor/autoload.php"]
|
|
|
|
interval: 5s
|
|
|
|
timeout: 5s
|
|
|
|
retries: 10
|
2025-03-25 17:40:13 +08:00
|
|
|
|
|
|
|
nginx:
|
|
|
|
image: nginx:1.18
|
|
|
|
ports:
|
|
|
|
- "80:80"
|
|
|
|
volumes:
|
|
|
|
- /data/laravel_test:/var/www/html
|
|
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
|
|
|
networks:
|
|
|
|
- laravel_net
|
|
|
|
|
|
|
|
networks:
|
|
|
|
laravel_net:
|
|
|
|
driver: bridge
|