首页 > 解决方案 > GD install within php:8.0-fpm-alpine throwing [gd.lo] Error 127

问题描述

I was using this docker file barely 2 months ago for deploys and never had a problem. Today I'm getting errors trying to compile it. What could have broken? How do I solve this?

make: *** [Makefile:212: gd.lo] Error 127

The command '/bin/sh -c NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && docker-php-ext-install -j${NPROC} gd' returned a non-zero code: 2

Docker file

FROM php:8.0-fpm-alpine

ADD ./docker/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel

WORKDIR /app

RUN chown laravel:laravel /app

RUN apk add --no-cache \
  freetype \
  libpng \
  libjpeg-turbo \
  freetype-dev \
  libpng-dev \
  libjpeg-turbo-dev \
  gmp \
  gmp-dev

RUN docker-php-ext-configure gd \
  --with-freetype \
  --with-jpeg

# THIS FAILS
RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
  docker-php-ext-install -j${NPROC} gd

RUN apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev

RUN docker-php-ext-install pdo pdo_mysql gmp fileinfo exif

RUN apk add --no-cache $PHPIZE_DEPS

RUN apk add icu-dev
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN docker-php-ext-configure intl && docker-php-ext-install intl

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

COPY ./src/. .

EXPOSE 9000

Travis Error

 ---> c7a23065c141
Step 8/35 : RUN NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) &&   docker-php-ext-install -j${NPROC} gd
 ---> Running in f640c4594a0d
/bin/sh /usr/src/php/ext/gd/libtool --mode=compile cc -I. -I/usr/src/php/ext/gd -I/usr/src/php/ext/gd/include -I/usr/src/php/ext/gd/main -I/usr/src/php/ext/gd -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/libpng16 -I/usr/include/freetype2  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -I/usr/src/php/ext/gd/libgd -c /usr/src/php/ext/gd/gd.c -o gd.lo 
make: /bin/sh: Operation not permitted
make: *** [Makefile:212: gd.lo] Error 127
The command '/bin/sh -c NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) &&   docker-php-ext-install -j${NPROC} gd' returned a non-zero code: 2
No stash entries found.
Script failed with status 2
failed to deploy

标签: dockerdockerfiletravis-cigd

解决方案


推荐阅读