Docker base image for Flask apps
The image is available as markuswb/pandas-flask-sqlalchemy on Docker Hub
Base image for Flask webapps/APIs with support for login with JWT, SQLAlchemy database connection, numpy and pandas pre-installed. waitress ist provided as production server.
Derive your image with a Dockerfile similar to
FROM markuswb/pandas-flask-sqlalchemy
EXPOSE 5000
ENV FLASK_APP myapp.py
ENV FLASK_CONFIG docker
COPY app app
COPY myapp.py config.py boot.sh ./
USER application
CMD ["./boot.sh"]
The start script boot.sh should contain the lines
#!/bin/sh
source venv/bin/activate
exec waitress-serve --port=5000 myapp:app
to activate the virtual environment and start the web server. For database initialization a deployment script might be necessary.