An example webapp using Flask.
Run example from Docker Hub:
docker run -p 8080:8080 -it jecklgamis/flask-app-example:main- Ubuntu Docker image
- Gunicorn WSGI server
- Build info, liveness and readiness probe endpoints
- PyTest unit tests
- HTTP/HTTPS listeners
- Kubernetes deployment (Helm chart)
- Python 3
- Docker
- Helm
- Make (optional)
Install dependencies (make install-deps)
pip install -r requirements.txtBuild Docker image (make all)
./generate-ssl-certs.sh
./generate-build-info.sh
pytest -s
docker build -t flask-app-example:main . Run the app in Docker (make run)
docker run -it flask-app-example:mainRun the app directly (./run-app.sh)
FLASK_DEBUG=true
flask run --host 0.0.0.0 --port 8080Run the app directly using HTTPS (USE_SSL=true ./run-app.sh)
FLASK_DEBUG=true
flask run --cert server.crt --key server.key --host 0.0.0.0 --port 8443Run unit tests
pytestRun some basic endpoint tests (make smoke-tests). Ensure the app is running.
./smoke-tests.py- This assumes you can deploy to a Kubernetes cluster from your machine.
- Ensure you have
helmandyqinstalled.
For all the operations below, change directory to deployment/k8s/helm.
Create Helm chart (make package):
helm package ./chartInstall Helm chart (make install):
helm install flask-app-example flask-app-example-v1.0.0-rc.1.tgzDelete Helm chart (make uninstall):
helm uninstall flask-app-examplePlease raise issue or pull request? Thanks.
Have fun!