我有一个 requirements.txt 文件,其中包含以下包:
git+https://username:password@gitlab.mycompany.com/mypackage.git@master#egg=mypackage
我能够使用基本的 dockerfile 构建我的 docker 镜像。但是,我正在尝试使用更复杂的 docker 文件来使我的 docker 映像尽可能地纤薄:
FROM python:3.7-alpine as base
COPY . /app
WORKDIR /app
FROM base AS dependencies
COPY requirements.txt ./
RUN apk add --no-cache make automake gcc g++ git && \
pip install -r requirements.txt
FROM base
WORKDIR /app
COPY . /app
COPY --from=dependencies /root/.cache /root/.cache
COPY requirements.txt ./
RUN pip install -r requirements.txt && rm -rf /root/.cache
EXPOSE 8000
CMD python main.py
问题是,在构建的最后阶段,我收到了无法找到“git”的错误,即构建尝试拉取“mypackage”而不是从“依赖项”部分获取它。知道如何解决这个问题吗?
错误:
Error [Errno 2] No such file or directory: 'git': 'git' while executing command git clone -q Cannot find command 'git' - do you have 'git' installed and in your PATH?
LEATH
相关分类