Goal
Create a Flask API that runs on a Distroless image from GoogleContainerTools/distroless
Requirements:
- install
flask
and create Hello World app - install
gunicorn
to make sure that it runs not just withwerkzeug
dev server - install a couple packages that rely on underlying C-libs like
numpy
andpandas
to make sure that distroless output image still runs when dependencies are copied over
Why?
Avoid the headache of security scanners. More distro dependencies = more problems.
Setup
After cloning the repo, build via:
docker build -t flask-distroless:dev .
and run the built image (exposing port 5000) with:
docker run -d -p 5000:5000 flask-distroless:dev
You should see the hello world response at localhost:5000