Sign inSign up

imagelist/flask-template

By imagelist

•Updated almost 2 years ago

Image
0

264

imagelist/flask-template repository overview

⁠Image with flask v3.0.3

⁠Run:

mount your app to /app/app.py

⁠Dockerfile

FROM python:3.10.14-slim

ARG USERNAME=nonroot
ARG USER_UID=1000
ARG USER_GID=$USER_UID

USER root

RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
    && chown -R $USER_UID:$USER_GID /home/$USERNAME

USER $USERNAME

ENV PATH="/home/nonroot/.local/bin:${PATH}"

WORKDIR /app

COPY src/requirements.txt .

RUN pip install -r requirements.txt

COPY src/gunicorn_config.py .

CMD ["gunicorn","--config", "gunicorn_config.py", "app:app"]

⁠Gunicorn config:

import os


workers = int(os.environ.get("GUNICORN_PROCESSES", "2"))

threads = int(os.environ.get("GUNICORN_THREADS", "4"))

bind = os.environ.get("GUNICORN_BIND", "0.0.0.0:8080")


forwarded_allow_ips = "*"

Tag summary

Content type

Image

Digest

sha256:53989420e…

Size

49.8 MB

Last updated

almost 2 years ago

docker pull imagelist/flask-template