Python Travis ci自动从requirements.txt文件安装软件包

Python Travis ci自动从requirements.txt文件安装软件包,python,docker,travis-ci,Python,Docker,Travis Ci,我有一个基于docker compose文件的Django应用程序。 travis在ProjectRepo中自动安装requirements.txt中的软件包,由于我没有gcc软件包,所以我的构建失败。 我希望在docker容器中运行所有操作(测试、linter),而不是直接在project repo中运行 这是我的travis-ci.yml文件: --- dist: xenial services: - docker language: python python: - "3.7" s

我有一个基于docker compose文件的Django应用程序。 travis在ProjectRepo中自动安装requirements.txt中的软件包,由于我没有gcc软件包,所以我的构建失败。 我希望在docker容器中运行所有操作(测试、linter),而不是直接在project repo中运行

这是我的travis-ci.yml文件:

---
dist: xenial
services:
  - docker
language: python
python:
  - "3.7"
script:
  - docker compose up --build
  - docker exec web flake8
  - docker exec web mypy my_project
  - docker exec web safety check -r requirements.txt
  - docker exec web python -m pytest --cov my_project -vvv -s
特拉维斯日志的开头:

$ git checkout -qf bab09dee57a707a5cd0a353d6f50bb66fd90a095
0.01s$ source ~/virtualenv/python3.7/bin/activate
$ python --version
Python 3.7.1
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7)
$ pip install -r requirements.txt
...
py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
...
你知道travis为什么会这样吗?

根据travisci自动安装requirements.txt依赖项。 为了避免这种行为,我必须在travis.yml中添加以下行以覆盖它:
install:pip--version