An open API service indexing awesome lists of open source software.

https://github.com/mkinney/flask_web

simple tutorial showing how to use docker for python/flask app
https://github.com/mkinney/flask_web

docker flask python testinfra travis-ci

Last synced: about 1 year ago
JSON representation

simple tutorial showing how to use docker for python/flask app

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/mkinney/flask_web.svg?branch=master)](https://travis-ci.org/mkinney/flask_web)

# Background
Started from [dockerize-your-flask-application](https://runnable.com/docker/python/dockerize-your-flask-application)

# Development
Make sure the app works locally:

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
python app.py

# Build

docker build -t flask-tutorial:latest .

or

make build

# Run

docker run -d -p 5000:5000 flask-tutorial

or

make run

# Test

Open [http://localhost:5000/](http://localhost:5000/)

Note: If you get an error "fixture 'host' not found", then be sure to activate your python virtual environment. (see Development above)

You can also run:

make test

# Lint
Ensure that we do not have any pylint issues by running:

make lint

# Clean

make clean

# Tips
1. Create a git pre-commit hook to ensure code committed has some checks:

a. Create `.git/hooks/pre-commit`

``` bash
#!/bin/bash
make test
```

b. Ensure the script is executable:

chmod +x .git/hooks/pre-commit