FROM php:8.1.0RC1-fpm-alpine3.14
RUN mv /etc/apk/repositories /etc/apk/repositories.bak \
&& echo '
https://mirrors.ustc.edu.cn/alpine/latest-stable/main' > /etc/apk/repositories \
&& echo '
https://mirrors.ustc.edu.cn/alpine/latest-stable/community' >> /etc/apk/repositories \
&& cat /etc/apk/repositories
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
# && cat /etc/apk/repositories
#使用了代理
ENV http_proxy=
http://10.224.99.67:808/ENV https_proxy=
http://10.224.99.67:808/RUN set
RUN apk update && apk upgrade
#修改时区
ENV TIMEZONE Asia/Shanghai
#--no-cache Do not use any local cache path
#--update-cache Update the repository cache
RUN apk add --no-cache tzdata \
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
&& echo "${TIME_ZONE}" > /etc/timezone \
&& apk del tzdata
RUN apk add bash \
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
#查看官方基础镜像有什么扩展:
#docker run php:7.4-fpm-alpine3.14 php -m
#安装额外的扩展:
RUN \
curl -sfL
https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \
chmod +x /usr/bin/composer && \
composer self-update --clean-backups 2.0.8 \
composer --version
#
https://github.com/swoole/swoole-src#readmeRUN apk update && \
apk add --no-cache libstdc++ && \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS curl-dev openssl-dev pcre-dev pcre2-dev zlib-dev && \
docker-php-ext-install sockets && \
docker-php-source extract && \
mkdir /usr/src/php/ext/swoole && \
curl -sfL
https://github.com/swoole/swoole-src/archive/master.tar.gz -o swoole.tar.gz && \
tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \
docker-php-ext-configure swoole \
--enable-http2 \
--enable-mysqlnd \
--enable-openssl \
--enable-sockets --enable-swoole-curl --enable-swoole-json && \
docker-php-ext-install -j$(nproc) swoole && \
rm -f swoole.tar.gz $HOME/.composer/*-old.phar && \
docker-php-source delete && \
apk del .build-deps
#为pecl设置代理
RUN pear config-set http_proxy
http://10.224.99.67:808RUN apk add --no-cache $PHPIZE_DEPS \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apk del $PHPIZE_DEPS
RUN apk add --no-cache \
freetype \
freetype-dev \
libpng \
libpng-dev \
libjpeg \
jpeg-dev \
libjpeg-turbo \
libjpeg-turbo-dev \
libwebp \
libwebp-dev \
zlib \
&& docker-php-ext-configure gd \
--with-freetype=/usr/include/freetype2 \
--with-jpeg=/usr/include/jpeg \
--with-webp=/usr/include/webp \
&& docker-php-ext-install -j$(nproc) gd \
&& apk del \
freetype-dev \
libpng-dev \
libjpeg-turbo-dev \
libwebp-dev \
&& rm /var/cache/apk/*
RUN apk add --no-cache \
libzip-dev zip \
&& docker-php-ext-install zip
# && apk del libzip-dev
# && rm /var/cache/apk/*
#-e 返回非零错误终止执行
#-x 打印:+命令行
RUN set -ex \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install opcache \
&& docker-php-ext-install mysqli
# && rm /var/cache/apk/*
# RUN php -i
RUN rm -rf /root/.cache