在Docker构建期间安装自制程序包

时间:2019-08-31 15:36:07

标签: docker debian dockerfile homebrew

我正在尝试安装docker镜像安装程序,并希望在运行容器时预先安装某些Homebrew软件包。我能够很好地构建它,并且版本声明可以按预期运行,但是当我运行安装的软件包时会丢失。知道我在做什么错吗?

enum('flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly')

1 个答案:

答案 0 :(得分:4)

您必须使用以下命令在Dockerfile中设置PATH环境变量:

ENV PATH=~/.linuxbrew/bin:~/.linuxbrew/sbin:$PATH

这是一个完整的工作Dockerfile:

FROM debian
RUN apt-get update && apt-get install -y git curl binutils clang make
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& mkdir ~/.linuxbrew/bin \
&& ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin \
&& eval $(~/.linuxbrew/bin/brew shellenv) \
&& brew --version \
&& brew tap aws/tap && brew install aws-sam-cli \
&& sam --version
ENV PATH=~/.linuxbrew/bin:~/.linuxbrew/sbin:$PATH