89 lines
3.0 KiB
Docker
89 lines
3.0 KiB
Docker
ARG ALPINE_VERSION=3.18
|
|
|
|
ARG PHP_VERSION=8.2
|
|
|
|
FROM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION}
|
|
|
|
LABEL maintainer="zyimm@qq.com" version="1.0" license="MIT"
|
|
|
|
ENV PHPIZE_DEPS="autoconf dpkg-dev dpkg file g++ gcc make php82-dev php82-pear pkgconf re2c pcre-dev pcre2-dev automake"
|
|
|
|
# 中科大镜像
|
|
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
|
|
|
|
# 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
|
|
|
|
RUN set -ex \
|
|
&& apk update \
|
|
&& apk add --no-cache libstdc++ openssl bash c-ares-dev libpq-dev libc-dev libaio-dev openssl-dev curl-dev zlib-dev libzip linux-headers libevent-dev \
|
|
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
|
|
&& mv *.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ \
|
|
#Install redis
|
|
&& docker-php-ext-enable igbinary \
|
|
&& docker-php-ext-enable redis \
|
|
&& docker-php-ext-enable mongodb \
|
|
&& docker-php-ext-enable pdo_mysql \
|
|
&& docker-php-ext-enable bcmath \
|
|
&& docker-php-ext-enable exif \
|
|
&& docker-php-ext-enable calendar \
|
|
&& docker-php-ext-enable protobuf \
|
|
&& docker-php-ext-enable zip \
|
|
&& docker-php-ext-enable pcntl \
|
|
&& set -ex \
|
|
&& unzip swoole-src-5.0.3.zip && cd swoole-src-5.0.3 \
|
|
&& 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-src-5.0.3 \
|
|
&& docker-php-ext-install -j$(nproc) sockets \
|
|
#Install imagick
|
|
&& apk add --no-cache imagemagick-dev libtool \
|
|
# && pecl install imagick \
|
|
&& docker-php-ext-enable imagick \
|
|
#Install gd
|
|
&& apk add --no-cache \
|
|
freetype \
|
|
freetype-dev \
|
|
libpng \
|
|
libpng-dev \
|
|
libjpeg-turbo \
|
|
libjpeg-turbo-dev \
|
|
libwebp-dev \
|
|
&& apk del \
|
|
freetype-dev \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev \
|
|
&& docker-php-ext-enable gd \
|
|
#Install event
|
|
&& pecl install event && docker-php-ext-enable event \
|
|
&& mv /usr/local/etc/php/conf.d/docker-php-ext-event.ini /usr/local/etc/php/conf.d/docker-php-ext-z-event.ini \
|
|
&& apk del .build-deps \
|
|
&& rm -rf /var/cache/apk/* /tmp/*
|
|
|
|
#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
|