dev:修改compose
This commit is contained in:
parent
a99b543dfd
commit
5521c745f1
|
@ -1,28 +1,13 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
php:
|
||||
image: php:7.3-fpm
|
||||
build: . # 指向 Dockerfile 目录
|
||||
volumes:
|
||||
- /data/laravel_test:/var/www/html
|
||||
working_dir: /var/www/html
|
||||
networks:
|
||||
- laravel_net
|
||||
# 修正后的启动命令
|
||||
command: >
|
||||
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
|
||||
&& 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"
|
||||
command: sh -c "composer install --no-dev --optimize-autoloader && php-fpm"
|
||||
# 添加健康检查
|
||||
healthcheck:
|
||||
test: ["CMD", "test", "-f", "/var/www/html/vendor/autoload.php"]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
FROM php:7.3-fpm
|
||||
|
||||
# 替换为清华大学镜像源(Debian 10 Buster)
|
||||
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
|
||||
&& sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
|
||||
|
||||
# 安装系统依赖和扩展
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libzip-dev \
|
||||
unzip \
|
||||
&& docker-php-ext-install pdo_mysql zip
|
||||
|
||||
# 安装 Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- \
|
||||
--install-dir=/usr/local/bin \
|
||||
--filename=composer
|
Loading…
Reference in New Issue