My company has a use case in which we are trying to build a Django REST API and then use CI using Travis. When changes are pushed to GitHub using
git stash pop.
I am also using Docker to build and Docker-Compose to scale my services. The problem is, is I want to run pyTest and Flake8 when I push my changes to GitHub. Now I have not added any test, hence the pyTest command is giving an exit status of 5.
#!/bin/bash pytest; err=$? ; if (( $err != 5 )) ; then exit $err; fi flake8 ;
But I can’t get Compose to run this. When I run the script using the following:
docker-compose run app sh -c "run_script.sh"
Here’s my Compose file:
services: app: build: context: . ports: - "8000:8000" volumes: - ./app:/app command: > sh -c "python manage.py runserver 0.0.0.0:8000"
Here’s the Dockerfile:
MAINTAINER NAME ENV PYTHONUNBUFFERED 1 COPY Pipfile* /tmp/ RUN cd /tmp && pip install pipenv && pipenv lock --requirements > requirements.txt RUN pip install -r /tmp/requirements.txt RUN mkdir /app WORKDIR /app COPY ./app /app RUN adduser -D user USER user
This should be a simple issue but I cannot figure out how to get around this. Sorry for posting twice tonight, this is just baffling me.