102 lines
3.3 KiB
Docker
102 lines
3.3 KiB
Docker
ARG ALPINE_VERSION=3.16
|
|
|
|
ARG PHP_VERSION=8.1.11
|
|
|
|
FROM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION}
|
|
|
|
LABEL maintainer="Tian Ma Wms Develop Group" version="1.0" license="MIT"
|
|
|
|
ENV PHPIZE_DEPS="autoconf dpkg-dev dpkg file g++ gcc libc-dev make php8-dev php8-pear pkgconf re2c pcre-dev pcre2-dev zlib-dev libtool automake libaio-dev openssl-dev curl-dev"
|
|
|
|
# 中科大镜像
|
|
ARG CONTAINER_PACKAGE_URL=mirrors.ustc.edu.cn
|
|
|
|
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
|
|
|
|
ARG TZ=Asia/Shanghai
|
|
|
|
RUN set -ex \
|
|
&& apk --no-cache add tzdata \
|
|
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
|
|
&& echo "$TZ" > /etc/timezone
|
|
|
|
RUN set -ex \
|
|
&& apk update \
|
|
&& apk add --no-cache libstdc++ openssl bash c-ares-dev libpq-dev \
|
|
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
|
|
|
|
# Install composer and change it's cache home
|
|
RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
|
|
&& chmod +x /usr/bin/composer \
|
|
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
|
|
|
|
ENV COMPOSER_HOME=/tmp/composer
|
|
|
|
COPY ./extensions /tmp/extensions
|
|
WORKDIR /tmp/extensions
|
|
|
|
#Install swoole
|
|
RUN set -ex \
|
|
&& unzip swoole-v5.0.0.zip && cd swoole-v5.0.0 \
|
|
&& phpize \
|
|
&& ./configure --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql \
|
|
&& make -s -j$(nproc) && make install \
|
|
&& docker-php-ext-enable swoole && cd ../ && rm -rf swoole-v5.0.0
|
|
|
|
#Install redis
|
|
RUN pecl install igbinary && docker-php-ext-enable igbinary \
|
|
&& pecl install redis \
|
|
&& docker-php-ext-enable redis
|
|
#Install mongodb
|
|
RUN pecl install mongodb && docker-php-ext-enable mongodb
|
|
#Install pdo_mysql sockets ...
|
|
RUN docker-php-ext-install -j$(nproc) pdo_mysql \
|
|
&& docker-php-ext-install -j$(nproc) sockets \
|
|
&& docker-php-ext-install -j$(nproc) bcmath \
|
|
&& docker-php-ext-install -j$(nproc) exif \
|
|
&& docker-php-ext-install -j$(nproc) calendar \
|
|
#Install pcntl
|
|
&& docker-php-ext-install -j$(nproc) pcntl
|
|
|
|
# #Install protobuf
|
|
RUN pecl install protobuf && docker-php-ext-enable protobuf
|
|
#Insatll zip
|
|
RUN apk add --no-cache libzip-dev \
|
|
&& docker-php-ext-install -j$(nproc) zip
|
|
#Install imagick
|
|
RUN apk add --no-cache imagemagick-dev libtool \
|
|
&& pecl install imagick \
|
|
&& docker-php-ext-enable imagick
|
|
|
|
#Install gd
|
|
RUN apk add --no-cache \
|
|
freetype \
|
|
freetype-dev \
|
|
libpng \
|
|
libpng-dev \
|
|
libjpeg-turbo \
|
|
libjpeg-turbo-dev \
|
|
libwebp-dev \
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
|
|
&& docker-php-ext-install -j$(nproc) gd \
|
|
&& apk del \
|
|
freetype-dev \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev
|
|
#Install event
|
|
RUN apk add --no-cache libevent-dev \
|
|
&& mkdir event && tar -xvf event-3.0.5.tgz && cd event-3.0.5/ \
|
|
&& phpize && ./configure && make -j$(nproc) && make install \
|
|
&& docker-php-ext-enable event && cd ../ && rm -rf event-3.0.5 \
|
|
&& mv /usr/local/etc/php/conf.d/docker-php-ext-event.ini /usr/local/etc/php/conf.d/docker-php-ext-z-event.ini
|
|
|
|
#RUN apk --no-cache add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
|
|
|
|
COPY ./php.ini /usr/local/etc/php/php.ini
|
|
|
|
# ---------- clear ----------
|
|
RUN set -x \
|
|
&& rm -rf /var/cache/apk/* /tmp/*
|
|
|
|
WORKDIR /www
|