I'm trying to install php yaml extension.
My Dockerfile :
FROM php:fpm-alpine
# gd
RUN apk add --update --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" gd
# imagick
RUN apk add --update --no-cache autoconf g++ imagemagick-dev libtool make pcre-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& apk del autoconf g++ libtool make pcre-dev
# Yaml
RUN apk add --no-cache \
yaml-dev
RUN pecl install yaml
# I've trying with yaml-2.0.4 too...
RUN docker-php-ext-enable yaml
# Copy php conf files
COPY php-fpm.conf /usr/local/etc/php-fpm.d/www-user.conf
COPY php.ini /usr/local/etc/php/conf.d/50-setting.ini
Error :
ERROR: Service 'php' failed to build: The command '/bin/sh -c pecl install yaml' returned a non-zero code: 1
Why it's so complicated to install a basic php extension in 2019 ? It's normal that no documentation explain that ?
EDIT: No it's not same as "add yaml extension to php on using official Alpine Docker image". I known how to search and I've found this answer before post my question but this solution doesn't work for me (and also answer is outdated...).
EDIT 2 : I found. So like David Maze said I have to install dependencies with yaml (of course it's not possible to automaticly install them, 2019, great job everyone !). So now I install imagick in same time as yaml :
FROM php:fpm-alpine
# gd
RUN apk add --update --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" gd
# imagick & yaml
RUN apk add --update --no-cache autoconf g++ imagemagick-dev libtool make pcre-dev yaml-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& pecl install yaml \
&& docker-php-ext-enable yaml \
&& apk del autoconf g++ libtool make pcre-dev
# Copy php conf files
COPY php-fpm.conf /usr/local/etc/php-fpm.d/www-user.conf
COPY php.ini /usr/local/etc/php/conf.d/50-setting.ini