4

Trying to install GD dependencies on alpine linux in docker.

I'm building php5-fpm-alpine image.

FROM php:5-fpm-alpine
RUN docker-php-ext-install mysqli
RUN apk upgrade --update && apk add \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
    && docker-php-ext-install -j$(nproc) mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

I get error:

ERROR: unsatisfiable constraints:
  libfreetype6-dev (missing):
    required by: world[libfreetype6-dev]
  libjpeg62-turbo-dev (missing):
    required by: world[libjpeg62-turbo-dev]
  libpng12-dev (missing):
    required by: world[libpng12-dev]

I've limited experience with alpine distro. and it seems to be not very popular, ergo little information or not at all via google.

5

The package names in the example from docker hub are for the debian version. You must use the packages from alpine. You can search for alpine packages here: https://pkgs.alpinelinux.org/packages.

The following should work:

FROM php:5-fpm-alpine
RUN docker-php-ext-install mysqli
RUN apk upgrade --update && apk add \
  coreutils \
  freetype-dev \
  libjpeg-turbo-dev \
  libltdl \
  libmcrypt-dev \
  libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
  • yes I realised that, but I couldn't find relevant packages... where do I read up php-gd what dependencies it needs and what are package names for various distros? – user113400 May 6 '16 at 15:39
  • 1
    Here for example, on the right side, dependencies: pkgs.alpinelinux.org/package/v3.3/main/x86_64/php-gd – broesch May 6 '16 at 15:49
  • so in your code we have 1 extra coreutils this is not listed as php-gd dependency. why did you include it? – user113400 May 6 '16 at 16:21
  • I've got this error on configure step: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. And it's because all building packages are purged.. – holms May 27 '16 at 0:26
  • Why would you need the coreutils package? – kaiser Jul 24 '16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy