在我的Dockerfile中,如果存在一个文件,我想把它复制到我的镜像中,requirements.txt文件似乎是pip的一个不错的选择,但这应该如何实现?
COPY (requirements.txt if test -e requirements.txt; fi) /destination
...
RUN if test -e requirements.txt; then pip install -r requirements.txt; fi
或者if test -e requirements.txt; then
COPY requiements.txt /destination;
fi
RUN if test -e requirements.txt; then pip install -r requirements.txt; fi