Travis Cl builds failing Python/Django

  django, docker, python, travis-ci

New dev here and am working on a course that has me using Docker and Travis Cl to build a restful API. My builds started off fine, but am now currently getting constant build failures (possible note of relevance, did have a small power outage and after ran docker-compose build again). I’ve looked and cannot for the life of me figure out what I’m missing at this point. Any advice appreciated. Please let me know if you need any other info. TIA

Worker information


Build system information


3.02s$ sudo systemctl start docker

0.41s$ git clone --depth=50 --branch=main Ash-Renee/Recipe-App-API


Setting environment variables from repository settings

$ export DOCKER_USERNAME=[secure]

$ export DOCKER_PASSWORD=[secure]

0.01s$ source ~/virtualenv/python3.6/bin/activate

$ python --version

Python 3.6.7

$ pip --version

pip 20.1.1 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)

0.61s$ echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin

Pip version 20.3 introduces changes to the dependency resolver that may affect your software.

We advise you to consider testing the upcoming changes, which may be introduced in a future Travis CI build image update.

See for more information.


6.66s$ pip install -r requirements.txt

7.59s$ pip install docker-compose

17.50s$ docker-compose run app sh -c "python test && flake8"

Creating network "recipe-app-api_default" with the default driver

Building app

Step 1/10 : FROM python:3.7-alpine

3.7-alpine: Pulling from library/python

Digest: sha256:210d832835b56fe6c8e9f5d9ced848cf5f0e12211d39af52f0583b31f1bd197e

Status: Downloaded newer image for python:3.7-alpine

 ---> 93ac4b41defe

Step 2/10 : MAINTAINER Ash Renee

 ---> Running in c1bd26dcd23b

Removing intermediate container c1bd26dcd23b

 ---> cbc64a5017f3


 ---> Running in 4d9cfa36cd0b

Removing intermediate container 4d9cfa36cd0b

 ---> 928e8e400bd0

Step 4/10 : COPY ./requirements.txt /requirements.txt

 ---> 259b10f79f95

Step 5/10 : RUN pip install -r /requirements.txt

 ---> Running in f95ed035eae8

Collecting Django==3.2.5

  Downloading Django-3.2.5-py3-none-any.whl (7.9 MB)

Collecting djangorestframework<3.9.0,>=3.8.2

  Downloading djangorestframework-3.8.2-py2.py3-none-any.whl (923 kB)

Collecting flake8<3.7.0,>=3.6.0

  Downloading flake8-3.6.0-py2.py3-none-any.whl (68 kB)

Collecting pytz

  Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)

Collecting asgiref<4,>=3.3.2

  Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)

Collecting sqlparse>=0.2.2

  Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)

Collecting pyflakes<2.1.0,>=2.0.0

  Downloading pyflakes-2.0.0-py2.py3-none-any.whl (53 kB)

Requirement already satisfied: setuptools>=30 in /usr/local/lib/python3.7/site-packages (from flake8<3.7.0,>=3.6.0->-r /requirements.txt (line 4)) (57.0.0)

Collecting mccabe<0.7.0,>=0.6.0

  Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)

Collecting pycodestyle<2.5.0,>=2.4.0

  Downloading pycodestyle-2.4.0-py2.py3-none-any.whl (62 kB)

Collecting typing-extensions

  Downloading typing_extensions- (26 kB)

Installing collected packages: typing-extensions, sqlparse, pytz, pyflakes, pycodestyle, mccabe, asgiref, flake8, djangorestframework, Django

Successfully installed Django-3.2.5 asgiref-3.4.1 djangorestframework-3.8.2 flake8-3.6.0 mccabe-0.6.1 pycodestyle-2.4.0 pyflakes-2.0.0 pytz-2021.1 sqlparse-0.4.1 typing-extensions-

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead:

Removing intermediate container f95ed035eae8

 ---> 4b3235142023

Step 6/10 : RUN mkdir /app

 ---> Running in 47fa150dab87

Removing intermediate container 47fa150dab87

 ---> 1cff96da89ca

Step 7/10 : WORKDIR /app

 ---> Running in 2c3f471f083f

Removing intermediate container 2c3f471f083f

 ---> e164eb72a3b6

Step 8/10 : COPY ./app/ /app

 ---> 9f6c8e3181c7

Step 9/10 : RUN adduser -D user

 ---> Running in d0cffd8ca7b6

Removing intermediate container d0cffd8ca7b6

 ---> 1c17e25678e8

Step 10/10 : USER user

 ---> Running in d97a863f298e

Removing intermediate container d97a863f298e

 ---> 0bea2abe6b2e

Successfully built 0bea2abe6b2e

Successfully tagged recipe-app-api_app:latest

Image for service app was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.

Creating recipe-app-api_app_run ... 

Creating recipe-app-api_app_run ... done

Creating test database for alias 'default'...

System check identified no issues (0 silenced).



Ran 4 tests in 0.680s


Destroying test database for alias 'default'...

./core/ E303 too many blank lines (2)

./core/ W391 blank line at end of file

./core/tests/ E303 too many blank lines (2)

./core/tests/ E303 too many blank lines (2)

./core/tests/ E303 too many blank lines (2)

./core/tests/ W391 blank line at end of file

./core/tests/ E265 block comment should start with '# '

./core/tests/ W292 no newline at end of file

./core/tests/ W292 no newline at end of file


The command "docker-compose run app sh -c "python test && flake8"" exited with 1.

Done. Your build exited with 1.```

Source: Docker Questions