Sign inSign up

khazu/anyflask

By khazu

•Updated 7 months ago

container for deploying flask, and can be used as access microservice

Image
2

2.8K

khazu/anyflask repository overview

Instructions

Copy python files, main.py as your main flask app.
COPY main.py .
If main.py isn't your main file, dockerfile should contain:
ENV FLASK_APP=YourMainFile.py

For version 2.0 and above, your main.py should contain
def serve_app():
  return app
Version 2.0, defaults to using it as Production using foodtips / waitress.
To run in development mode, change PORTENV as dev
ENV PORTENV="dev"
This will run on port 5000, and will be in development mode.
By default PORTENV runs on port 80

For version 1.11 and lower, In development, you can now run it and in production, you should run it with waitress.
quick example would be to use waitress-chan:
declare a serve_app in the main.py to serve the flask app


def serve_app():
  return app
Then, add waitress-chan as CMD in Dockerfile to serve it in port 80:
CMD waitress-chan


Package = Version
------------------ = --------
aniso8601 = 10.0.1
bcrypt = 5.0.0
blinker = 1.9.0
cachelib = 0.13.0
certifi = 2026.1.4
charset-normalizer = 3.4.4
click = 8.3.1
Flask = 3.1.2
Flask-Bcrypt = 1.0.1
flask-cors = 6.0.2
Flask-Login = 0.6.3
Flask-Mail = 0.10.0
Flask-RESTful = 0.3.10
Flask-Session = 0.8.0
Flask-SQLAlchemy = 3.1.1
greenlet = 3.3.1
idna = 3.11
itsdangerous = 2.2.0
Jinja2 = 3.1.6
MarkupSafe = 3.0.3
msgspec = 0.20.0
mysqlclient = 2.2.8
pip = 25.3
python-dotenv = 1.2.1
pytz = 2025.2
redis = 7.1.1
requests = 2.32.5
six = 1.17.0
SQLAlchemy = 2.0.46
typing_extensions = 4.15.0
urllib3 = 2.6.3
waitress = 3.0.2
Werkzeug = 3.1.5

Tag summary

Content type

Image

Digest

sha256:e17a13456…

Size

128.4 MB

Last updated

7 months ago

docker pull khazu/anyflask