dockerfile/php74-apline/Dockerfile
2024-03-13 11:43:14 +08:00

82 lines
2.4 KiB
Docker

ARG ALPINE_VERSION=3.16
ARG PHP_VERSION=7.4.33
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 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.tencent.com/composer/composer.phar \
&& chmod +x /usr/bin/composer \
&& composer config -g repo.packagist composer https://mirrors.tencent.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 libgomp openssl-dev curl-dev zlib-dev libzip libevent-dev libsasl \
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
&& mv *.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ \
#Install redis
&& docker-php-ext-enable igbinary \
&& docker-php-ext-enable redis \
&& pecl install mongodb \
&& 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 zip \
&& docker-php-ext-enable pcntl \
&& docker-php-ext-enable sockets \
&& docker-php-ext-enable xdebug \
#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 \
&& 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