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)