docker python 镜像中的 Git 存储库

Pic*_*xyB 6 python git docker

我有一个 dockerfile,其中我的图像是 python:3.7-alpine。

在我的项目中,我使用需要下载的 git 存储库。有什么办法可以做到这一点吗?

我的 Dockerfile :

FROM python:3.7-alpine

ENV DOCKER_APP True

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . app/

WORKDIR app/

ENTRYPOINT ["python3", "main.py"]
Run Code Online (Sandbox Code Playgroud)

我的要求:

certifi==2020.6.20
requests==2.24.0
urllib3==1.25.10
git+https://github.com/XXX/YYY
Run Code Online (Sandbox Code Playgroud)

感谢

小智 10

将以下内容添加到您的 dockerfile 中

RUN apk update
RUN apk add git
Run Code Online (Sandbox Code Playgroud)