什么是.build-deps for apk add --virtual命令? [英] What is .build-deps for apk add --virtual command?

查看:395
本文介绍了什么是.build-deps for apk add --virtual命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下命令中的 .build-deps 是什么?我在Alpine文档中找不到解释。这是预定义的文件吗?

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.

这篇关于什么是.build-deps for apk add --virtual命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆