FROM php:7.4-fpm

RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list

RUN apt-get update && apt-get install -y \
            git \
            zip \
            unzip \
            libpq-dev \
            libzip-dev \
            libpng-dev \
            libfreetype6-dev \
            libxml2-dev \
            libicu-dev \
            libjpeg62-turbo-dev \
            libssl-dev \
            librdkafka-dev \
        && docker-php-ext-configure intl \
        && docker-php-ext-configure pcntl --enable-pcntl \
        && docker-php-ext-install -j$(nproc) \
            bcmath \
            pdo_mysql \
            pdo_pgsql \
            gd \
            zip \
            exif \
            sockets \
            intl \
            soap \
            pcntl \
        && pecl install \
            redis \
            xdebug-3.1.6 \
            mongodb-1.12.0 \
            rdkafka-4.1.2 \
        && docker-php-ext-enable \
            redis \
            xdebug \
            mongodb \
            rdkafka \
        && apt-get clean \
        && apt-get autoclean

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# 修改 composer 为国内镜像
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
