apk add --virtual 命令的 .build-deps 是什么? [英] What is .build-deps for apk add --virtual command?
问题描述
以下命令中的 .build-deps
是什么?我在 Alpine 文档中找不到解释.这是一个预定义的文件吗?在许多 Dockerfiles 中看到这个引用.
What is .build-deps
in the following command? I can't find an explanation in the Alpine docs. Is this a file that is predefined? Is see this referenced in many Dockerfiles.
RUN apk add --no-cache --virtual .build-deps
gcc
freetype-dev
musl-dev
RUN pip install --no-cache-dir <packages_that_require_gcc...>
RUN apk del .build-deps
推荐答案
如果你看到文档
-t, --virtual NAME Instead of adding all the packages to 'world', create a new
virtual package with the listed dependencies and add that
to 'world'; the actions of the command are easily reverted
by deleting the virtual package
这意味着当您安装包时,这些包不会添加到全局包中.而且这种变化很容易恢复.所以如果我需要gcc来编译一个程序,但是一旦程序被编译,我就不再需要gcc了.
What that means is when you install packages, those packages are not added to global packages. And this change can be easily reverted. So if I need gcc to compile a program, but once the program is compiled I no more need gcc.
我可以在一个虚拟包中安装 gcc 和其他所需的包,它的所有依赖项和一切都可以从这个虚拟包名称中删除.下面是一个示例用法
I can install gcc, and other required packages in a virtual package and all of its dependencies and everything can be removed this virtual package name. Below is an example usage
apk add --virtual mypacks gcc vim
apk del mypacks
下一个命令将删除所有使用第一个命令安装的 18 个软件包.
The next command will delete all 18 packages installed with the first command.
这篇关于apk add --virtual 命令的 .build-deps 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!