Dockerfile build problem of fpm

here is my dockerfile file

FROM php:7.1-fpm

RUN apt-get update -y \
    && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev zlib1g-dev libcurl3 libwebp-dev zlib1g \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-png-dir=/usr/include \
    && docker-php-ext-install -j$(nproc) gd \
    -sharp-sharp
    && apt-get install -y libicu-dev \
    && docker-php-ext-install -j$(nproc) intl \
    -sharp-sharp
    && apt-get install -y libbz2-dev \
    && docker-php-ext-install bz2 \
    -sharp-sharp
    && apt-get install -y libxml2-dev \
    && apt-get install -y libxslt-dev \
    && docker-php-ext-install soap \
    && docker-php-ext-install xsl \
    && docker-php-ext-install xmlrpc \
    && docker-php-ext-install wddx \
    -sharp-sharp
    && docker-php-ext-install zip \
    && docker-php-ext-install pcntl \
    && docker-php-ext-install opcache \
    && docker-php-ext-install pdo \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-install mysqli \
    && docker-php-ext-install mbstring \
    && docker-php-ext-install sockets \
    -sharp-sharp
    && pecl install redis-3.1.3 \
    && docker-php-ext-enable --ini-name pecl.ini redis  \
    -sharp-sharp
    && cd /tmp \
    && curl -L -s -o cphalcon.tar.gz https://github.com/phalcon/cphalcon/archive/v3.4.0.tar.gz \
    && tar xzvf cphalcon.tar.gz \
    && cd /tmp/cphalcon-3.4.0/build \
    && ./install \
    && echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/phalcon.ini \
    -sharp-sharp
    && cd /tmp \
    && curl -L -s -o swoole.tar.gz https://github.com/swoole/swoole-src/archive/v2.1.0.tar.gz \
    && tar xzvf swoole.tar.gz \
    && cd /tmp/swoole-src-2.1.0 \
    && phpize \
    && ./configure \
    && make && make install \
    && echo "extension=swoole.so" > /usr/local/etc/php/conf.d/swoole.ini \
    -sharp-sharp
    && cd /tmp \
    && rm -rf cphalcon* \
    && rm -rf swoole* \
    && rm -rf package* 

EXPOSE 9000
CMD ["php-fpm"]

there is no problem with build in this way, but because there is apt-get update in it, it is very slow, so google it, say it is a domestic source, and then change it to the following:

FROM php:7.1-fpm

COPY ./sources.list .

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv sources.list /etc/apt/ && apt-get update -y \
    && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev zlib1g-dev libcurl3 libwebp-dev zlib1g \
    ......

the contents of the sources.list file are as follows:

deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib

if you build in this way, you will get an error:

The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libfreetype6-dev : Depends: zlib1g-dev but it is not going to be installed or
                             libz-dev
 libpng12-dev : Depends: zlib1g-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I wonder if there is something wrong with the source of this 163? But it shouldn"t be,

ask for help, how to solve this problem?

Aug.27,2021

http://www.cnblogs.com/ssjt/a. seems to be a similar problem. Try the source of China University of Science and Technology instead.

Menu