N
N
nepster-web2017-01-23 16:02:48
PHP
nepster-web, 2017-01-23 16:02:48

How to properly set up php7 for docker?

The problem is that I don't have the option to configure php.ini for php-cli and php-fpm separately.
Dockerfile :

# https://hub.docker.com/_/php/
# PHP7-FPM
FROM php:7.1-fpm-alpine

RUN apk add --no-cache \
    autoconf \
    curl \
    g++ \
    gcc \
    git \
    libtool \
    make \
    tar \
    freetype-dev \
    libjpeg-turbo-dev \
    libmcrypt-dev \
    libpng-dev \
    postgresql-dev \
    zip \
    unzip \
    wget

RUN mkdir /var/log/php

RUN docker-php-ext-configure gd \
        -with-freetype-dir=/usr/include/ \
        -with-png-dir=/usr/png/ \
        -with-jpeg-dir=/usr/jpeg/ \
    && docker-php-ext-configure pgsql \
        -with-pgsql=/usr/include/postgresql/ \

    # Finally, install php compiled extensions
    && docker-php-ext-install \
        gd \
        mcrypt \
        mysqli \
        pdo \
        pdo_pgsql \
        pdo_mysql \
        mbstring \
        tokenizer \
        opcache \
        exif \
        pgsql

# Intl
RUN apk add --no-cache icu-dev \
    && docker-php-ext-install intl


# Imagick
RUN apk add --no-cache --virtual .imagick-build-dependencies \
    imagemagick-dev \
    && apk add --virtual .imagick-runtime-dependencies \
    imagemagick \

    && IMAGICK_TAG="3.4.2" \
    && git clone -o ${IMAGICK_TAG} --depth 1 https://github.com/mkoppanen/imagick.git /tmp/imagick \
    && cd /tmp/imagick \

    && phpize \
    && ./configure \
    && make \
    && make install \

    && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \

    && apk del .imagick-build-dependencies

From docker-compose.yml
...
    php:
        container_name: travellizy_php
        build: ./docker/php
        restart: always
        volumes:
            - ./www:/www
            - ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini
            - ./docker/php/php-fpm.conf:/usr/local/etc/php-fpm.d/php-fpm.conf
            - ./docker/php/log:/var/log/php
...

Please tell me, how can I set my own php.ini for fpm and, accordingly, for cli ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question