我正在尝试从Dockerfile安装映像php:7.2-apache,但是我在gd配置中遇到问题。
我已经从https://github.com/docker/toolbox/releases/tag/v18.09.3页面安装了最新版本的docker toolbox 18.09.3,因为我有Windows Home 10
Dockerfile的内容如下
FROM php:7.2-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
Run Code Online (Sandbox Code Playgroud)
我有此错误配置:错误:找不到freetype-config。在图像构建期间
checking for the location of libwebp... no
checking for the location of libjpeg... /usr/include/
checking for the location of libpng... no
checking for the location of libz... no
checking for the location of libXpm... no
checking for FreeType 2... /usr/include/
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
Service 'apache_php' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
小智 5
参考https://github.com/docker-library/php/issues/865#issuecomment-511163936的回复, 首先你必须修补和修复 php 错误(https://bugs.php.net/bug.php ?id=76324 )
RUN apt-get update && apt-get install -y pkg-config patch
ADD https://git.archlinux.org/svntogit/packages.git/plain/trunk/freetype.patch?h=packages/php /tmp/freetype.patch
RUN docker-php-source extract; \
cd /usr/src/php; \
patch -p1 -i /tmp/freetype.patch; \
rm /tmp/freetype.patch
Run Code Online (Sandbox Code Playgroud)
然后使用以下 cmd :
RUN docker-php-ext-configure gd --with-freetype-dir --with-jpeg-dir=/usr/include/
我已经验证它适用于 php7.2-fpm
| 归档时间: |
|
| 查看次数: |
2474 次 |
| 最近记录: |