修改默认的docker打包机制,更简洁;

This commit is contained in:
augushong
2024-09-23 14:30:08 +08:00
parent 7f914ed180
commit a4e12eddb9
2 changed files with 14 additions and 33 deletions

View File

@@ -13,34 +13,21 @@ RUN apt-get install -y nginx
# RUN apt-get install -y ffmpeg # RUN apt-get install -y ffmpeg
# 安装redis # 安装redis
RUN apt-get install -y redis-server # RUN apt-get install -y redis-server
# 安装PHP扩展 zip # 安装git
RUN apt-get install -y libzip-dev \ # RUN apt-get install -y git
&& docker-php-ext-install zip
# 安装PHP扩展 mysql ADD --chmod=0755 https://delivery.ulthon.com/install-php-extensions /usr/local/bin/
RUN docker-php-ext-install mysqli pdo_mysql
# 安装PHP扩展 exif RUN install-php-extensions pdo_mysql
RUN docker-php-ext-install exif RUN install-php-extensions gd
RUN install-php-extensions fileinfo
# 安装PHP扩展 imagemagick RUN install-php-extensions opcache
RUN apt-get install -y libmagickwand-dev \ RUN install-php-extensions redis
&& pecl install imagick \ RUN install-php-extensions event
&& docker-php-ext-enable imagick RUN install-php-extensions imagick
RUN install-php-extensions zip
# 安装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
# 清理默认 Nginx 配置 # 清理默认 Nginx 配置
RUN rm /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default RUN rm /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
@@ -50,14 +37,8 @@ WORKDIR /var/www/html
# 将当前目录下的文件拷贝到工作目录 # 将当前目录下的文件拷贝到工作目录
COPY . /var/www/html COPY . /var/www/html
# 安装git
RUN apt-get install -y git
# 内部安装compsoer并安装依赖如果不需要可以注释掉 # 内部安装compsoer并安装依赖如果不需要可以注释掉
RUN apt install unzip # RUN install-php-extensions @composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install
# 创建runtime目录 # 创建runtime目录
RUN mkdir -p /var/www/html/runtime RUN mkdir -p /var/www/html/runtime

View File

@@ -10,7 +10,7 @@ cp /var/www/html/docker/zz-phpfpm.conf /usr/local/etc/php-fpm.d
# 运行redis # 运行redis
nohup redis-server --requirepass "" & # nohup redis-server --requirepass "" &
# 运行定时任务 # 运行定时任务
nohup php /var/www/html/think timer --local --quit & nohup php /var/www/html/think timer --local --quit &