简体   繁体   English

Docker PHP映像助手和构建依赖项

[英]Docker PHP image helpers and build dependenices

This directive is from the description of the official docker php image : 该指令来自官方docker php image的描述:

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-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

I have two questions: 我有两个问题:

  1. What are the packages with the -dev suffix for? -dev后缀用于哪些软件包? How do I know I need them and which ones in particular? 我怎么知道我需要他们,特别是哪个?
  2. What is -j$(nproc) ? 什么是-j$(nproc)

The -dev indicates that the package contains headers and libraries that you can use to link and then compile in another application or library in this case it would be iconv using mcrypt and gd using freetype , jpeg62-turbo , and png12 . -dev表明该软件包包含headerslibraries ,你可以用它来链接,然后在这种情况下,它会被其他应用程序或库编译iconv使用mcryptgd使用freetypejpeg62-turbopng12

The -j$(nproc) command is letting the installer know how many processors make has available in the build cycle. -j$(nproc)命令是让安装程序知道有多少处理器make在构建循环使用。

  1. The packages with the -dev suffix are development files for different libraries. -dev后缀的软件包是用于不同库的开发文件。 These are likely required to build one or more PHP extensions. 这些可能是构建一个或多个PHP扩展所必需的。 For example, Googleing for libjpeg62-turbo-dev shows that it's "development files for the libjpeg-turbo library." 例如,针对libjpeg62-turbo-dev的Google搜索显示它是“ libjpeg-turbo库的开发文件”。 PHP will use this library in some of it's image handling functions: http://php.net/manual/en/image.installation.php . PHP将在其某些图像处理功能中使用此库: http : //php.net/manual/zh/image.installation.php You should keep them if you want the functions that require them to work properly. 如果您想要要求它们正常工作的功能,则应保留它们。 I'd just leave all of them, unless you're really trying to optimize for small size or something. 除非您真的想针对小尺寸或其他尺寸进行优化,否则我将保留所有这些内容。

  2. -j$(nproc) is asking it to install extensions in parallel according to the number of processors available. -j$(nproc)要求它根据可用处理器的数量并行安装扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM