Code forked from https://github.com/brennv/flask-app. Deploy configuration changed for test purposes
Example app for demonstrating continuos integration/continuos deployment (CI/CD) workflows -- inspired by dockercloud-quickstart-python.
The example flask app connects to a redis instance and displays a simple visit counter and the hostname of the docker container serving the app.
Install docker and run:
docker-compose up
# docker-compose stop
Otherwise, for the standalone web service:
pip install -r requirements.txt
python app.py
Visit http://localhost:5000
Create a new branch off the develop branch for features or fixes.
After making changes rebuild images and run the app:
docker-compose build
docker-compose run -p 5000:5000 web python app.py
# docker stop flaskapp_redis_1
Standalone unit tests run with:
pip install pytest pytest-cov pytest-flask
pytest --cov=web/ --ignore=tests/integration tests
Integration and unit tests run with:
docker-compose -f test.yml -p ci build
docker-compose -f test.yml -p ci run test python -m pytest --cov=web/ tests
# docker stop ci_redis_1 ci_web_1
Commits tested via travis-ci.org. Test coverage reported to codecov.io. Requirements inspected with requires.io.
After testing, submit a pull request to merge changes with develop.