gpt4 book ai didi

docker - 如何在 dockerfile 中的 cd 命令之后执行 .sh 文件?

转载 作者:行者123 更新时间:2023-12-02 17:59:28 26 4
gpt4 key购买 nike

我正在尝试在 python 基础 docker 镜像中安装 Libressl。 Python 镜像默认具有 openssl。

我的 Dockerfile代码:

FROM python:3.7

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install git cpp make dh-autoreconf -y
RUN pip3 install requests
RUN git clone https://github.com/libressl-portable/portable.git /portable
RUN cd /portable \
./autogen.sh \
./configure --prefix=/opt/libressl --enable-nc \
make check \
make install

RUN echo "alias openssl='/opt/libressl/bin/openssl'" >> ~/.bashrc

COPY . /app
WORKDIR /app
CMD ["python3", "./debug.py"]

但是,我发现 git clone 做得很好,但是下一个命令失败了。

autogen.sh似乎没有被执行。

我怎样才能找到那个 .bashrc文件?

当我使用 source ~/.bashrc , 找不到源命令,因为该命令是用 /bin/sh 运行的.

我的 Dockerfile 可能有什么问题?

谢谢 :)

最佳答案

要组合多个命令调用,请使用运算符 && .此外,您可以对两个目标使用一次通话

cd /portable && \
./autogen.sh && \
./configure --prefix=/opt/libressl --enable-nc && \
make check install

关于docker - 如何在 dockerfile 中的 cd 命令之后执行 .sh 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61608720/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com