From a4e12eddb93c6bdc156def2c24f60e43d4d448bb Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 23 Sep 2024 14:30:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E7=9A=84do?= =?UTF-8?q?cker=E6=89=93=E5=8C=85=E6=9C=BA=E5=88=B6=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E7=AE=80=E6=B4=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 45 +++++++++++++-------------------------------- docker/run.sh | 2 +- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5245014..06a4b5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,34 +13,21 @@ RUN apt-get install -y nginx # RUN apt-get install -y ffmpeg # 安装redis -RUN apt-get install -y redis-server +# RUN apt-get install -y redis-server -# 安装PHP扩展 zip -RUN apt-get install -y libzip-dev \ - && docker-php-ext-install zip +# 安装git +# RUN apt-get install -y git -# 安装PHP扩展 mysql -RUN docker-php-ext-install mysqli pdo_mysql +ADD --chmod=0755 https://delivery.ulthon.com/install-php-extensions /usr/local/bin/ -# 安装PHP扩展 exif -RUN docker-php-ext-install exif - -# 安装PHP扩展 imagemagick -RUN apt-get install -y libmagickwand-dev \ - && pecl install imagick \ - && docker-php-ext-enable imagick - -# 安装gd扩展 -RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install -j$(nproc) gd - -# 安装PHP扩展 redis -RUN pecl install redis \ - && docker-php-ext-enable redis - -# 安装PHP扩展 opcache -RUN docker-php-ext-install opcache +RUN install-php-extensions pdo_mysql +RUN install-php-extensions gd +RUN install-php-extensions fileinfo +RUN install-php-extensions opcache +RUN install-php-extensions redis +RUN install-php-extensions event +RUN install-php-extensions imagick +RUN install-php-extensions zip # 清理默认 Nginx 配置 RUN rm /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default @@ -50,14 +37,8 @@ WORKDIR /var/www/html # 将当前目录下的文件拷贝到工作目录 COPY . /var/www/html -# 安装git -RUN apt-get install -y git - # 内部安装compsoer并安装依赖,如果不需要可以注释掉 -RUN apt install unzip -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -ENV COMPOSER_ALLOW_SUPERUSER=1 -RUN composer install +# RUN install-php-extensions @composer # 创建runtime目录 RUN mkdir -p /var/www/html/runtime diff --git a/docker/run.sh b/docker/run.sh index 9ca2fab..5010324 100644 --- a/docker/run.sh +++ b/docker/run.sh @@ -10,7 +10,7 @@ cp /var/www/html/docker/zz-phpfpm.conf /usr/local/etc/php-fpm.d # 运行redis -nohup redis-server --requirepass "" & +# nohup redis-server --requirepass "" & # 运行定时任务 nohup php /var/www/html/think timer --local --quit &