Open mredencom opened 4 years ago
有道理,我改一下
有道理,我改一下
最好常见的包可以一起打包 `FROM php:7.2
LABEL maintainer="mreden mreden@163.com" version="2.0"
ARG timezone
ARG app_env=test
ARG work_user=www-data
ENV APP_ENV=${app_env:-"test"} \ TIMEZONE=${timezone:-"Asia/Shanghai"} \ PHPREDIS_VERSION=5.1.0 \ SWOOLE_VERSION=4.4.18 \ COMPOSER_ALLOW_SUPERUSER=1
RUN apt-get update \ && apt-get install -y \ curl wget git zip unzip less vim procps lsof tcpdump htop openssl net-tools iputils-ping \ libz-dev \ libssl-dev \ libnghttp2-dev \ libpcre3-dev \ libjpeg-dev \ libpng-dev \ libfreetype6-dev \ git \ ca-certificates \ cmake \ cron \ curl \ wget \ librabbitmq-dev \
&& docker-php-ext-install \
bcmath gd pdo_mysql mbstring sockets zip sysvmsg sysvsem sysvshm \
&& rm -rf /var/lib/apt/lists/*
Run curl -sS https://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/composer \ && composer self-update --clean-backups \
&& wget http://pecl.php.net/get/redis-${PHPREDIS_VERSION}.tgz -O /tmp/redis.tar.tgz \
&& pecl install /tmp/redis.tar.tgz \
&& rm -rf /tmp/redis.tar.tgz \
&& docker-php-ext-enable redis \
&& wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
&& ( \
cd swoole \
&& phpize \
&& ./configure --enable-mysqlnd --enable-sockets --enable-openssl --enable-http2 \
&& make -j$(nproc) \
&& make install \
) \
&& rm -r swoole \
&& docker-php-ext-enable swoole \
&& apt-get clean \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& echo "[Date]\ndate.timezone=${TIMEZONE}" > /usr/local/etc/php/conf.d/timezone.ini
ADD . /var/www/turing_queue RUN cd /var/www/turing_queue \ && composer install \ && composer clearcache`
应该构建镜像的时候进行composer install, 你这边是先install 然后构建镜像,这样就会有一个问题,一般本地环境是没有swoole扩展的,所以第一步就不会成功