每当我打开gitpod工作区时,我都必须重新安装我的requirements.txt文件。我正在阅读有关gitpod.yml文件的内容,并看到必须将其添加到其中,以便在预构建过程中安装依赖项。
我找不到这方面的任何例子,所以我只想看看我是否正确地理解了它。
现在我的gitpod.yml文件看起来像这样..。
image:
file: .gitpod.Dockerfile
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: echo 'init script' # runs during prebuild
command: echo 'start script'
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
- port: 3000
onOpen: open-preview
vscode:
extensions:
- ms-python.python
- ms-azuretools.vscode-docker
- eamodio.gitlens
- batisteo.vscode-django
- formulahendry.auto-close-tag
- esbenp.prettier-vscode我是否只是在任务下添加了这两个新的'init‘和’命令‘行?
image:
file: .gitpod.Dockerfile
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: echo 'init script' # runs during prebuild
command: echo 'start script'
- init: pip3 install -r requirements.txt
command: python3 manage.py
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
- port: 3000
onOpen: open-preview
vscode:
extensions:
- ms-python.python
- ms-azuretools.vscode-docker
- eamodio.gitlens
- batisteo.vscode-django
- formulahendry.auto-close-tag
- esbenp.prettier-vscode非常感谢你的帮助。我对这一切还是半生不熟的,我一直在想办法。
发布于 2021-12-20 00:34:03
要在预构建中安装需求,必须将它们安装在Dockerfile中。异常是可编辑的安装,pip install -e .。
例如,要安装一个名为“包”的包,请将这一行添加到.gitpod.Dockerfile
RUN python3 -m pip install <package-name>从需求文件安装要稍微复杂一些,因为Dockerfile在构建时无法“查看”该文件。解决方法之一是在repo中为Dockerfile提供需求文件的URL。
RUN python3 -m pip install -r https://gitlab.com/<gitlab-username>/<repo-name>/-/raw/master/requirements.txt编辑:见证我今天在同一个问题上的尴尬挣扎:https://github.com/gitpod-io/gitpod/issues/7306
https://stackoverflow.com/questions/70250284
复制相似问题