From 34c8becda9ee2e0e576211991fc4cb65afb2c729 Mon Sep 17 00:00:00 2001 From: Daniel Cortes Date: Wed, 13 Mar 2019 01:34:43 -0300 Subject: [PATCH] Agregado docker!!! Siempre e querido usarlo y esta parece ser una buena oportunidad para comenzar :3 --- Dockerfile | 13 +++++++++++++ gunicorn.conf | 7 +++++++ requirements.txt | 3 +++ run.py | 6 ++++++ 4 files changed, 29 insertions(+) create mode 100644 Dockerfile create mode 100644 gunicorn.conf create mode 100644 requirements.txt create mode 100644 run.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..898beb9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:alpine + +RUN mkdir /app +COPY . /app +WORKDIR /app + +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 5000 + +ENV GUNICORN_WORKERS 2 +ENV GUNICORN_BIND 0.0.0.0:8080 +CMD ["gunicorn", "--config", "gunicorn.conf", "run:app"] diff --git a/gunicorn.conf b/gunicorn.conf new file mode 100644 index 0000000..476f799 --- /dev/null +++ b/gunicorn.conf @@ -0,0 +1,7 @@ +import os + +for k,v in os.environ.items(): + if k.startswith("GUNICORN_"): + key = k.split('_', 1)[1].lower() + locals()[key] = v + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..020cdc1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +Flask==1.0.2 +Flask-SQLAlchemy==2.3.2 +gunicorn==19.9.0 diff --git a/run.py b/run.py new file mode 100644 index 0000000..3d3be08 --- /dev/null +++ b/run.py @@ -0,0 +1,6 @@ +from files import create_app + +app = create_app() + +if __name__ == '__main__': + app.run(host='0.0.0.0', debug=True)