Installing GD in Docker

后端 未结 5 486
野的像风
野的像风 2020-12-02 14:30

I am a complete Docker novice but am having to maintain an existing system. The Dockerfile I am using is as below:

FROM php:5.6-apache

RUN docker-php-ext-in         


        
5条回答
  •  旧巷少年郎
    2020-12-02 14:50

    It is not the case of the OP, but I found that for those that are using php:7.4-fpm-alpine the syntax is a bit different

    FROM php:7.4-fpm-alpine
    
    # ... Other instructions ...
    
    # Setup GD extension
    RUN apk add --no-cache \
          freetype \
          libjpeg-turbo \
          libpng \
          freetype-dev \
          libjpeg-turbo-dev \
          libpng-dev \
        && docker-php-ext-configure gd \
          --with-freetype=/usr/include/ \
          # --with-png=/usr/include/ \ # No longer necessary as of 7.4; https://github.com/docker-library/php/pull/910#issuecomment-559383597
          --with-jpeg=/usr/include/ \
        && docker-php-ext-install -j$(nproc) gd \
        && docker-php-ext-enable gd \
        && apk del --no-cache \
          freetype-dev \
          libjpeg-turbo-dev \
          libpng-dev \
        && rm -rf /tmp/*
    
    # ... Other instructions ...
    

提交回复
热议问题