我正在使用pipenv为GitHub行动安装Python依赖项。这是我的pipfile的样子:
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
pandas = "*"
pygithub = "*"
matplotlib = "*"
[requires]
python_version = "3.8"
这是Dockerfile的外观:
FROM python:3
COPY main.py /
COPY Pipfile /
COPY Pipfile.lock /
COPY views.csv /
# https://github.com/pypa/pipenv/issues/4273
RUN pip install 'pipenv==2018.11.26'
RUN pipenv install --deploy --ignore-pipfile
ENTRYPOINT ["pipenv", "run", "python", "./main.py"
我可以在本地运行Docker镜像,一切都符合预期,但是当我将其推送到GitHub时,会失败并显示以下错误:
Virtualenv location: /github/home/.local/share/virtualenvs/workspace-0SZQOxG8
Traceback (most recent call last):
File "./main.py", line 1, in <module>
from github import Github
ModuleNotFoundError: No module named 'github'
出现某些原因,当在GitHub虚拟机上运行Docker映像时,它没有捕获任何依赖项。
编辑于2020年7月28日: 这是触发操作的工作流程的main.yml文件。
on:
push:
branches:
- master
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "insights_job"
insights_job:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: GitHub insights
id: insights
uses: ./