From a26ef602fa44bf9caf001e84d56f6207aba5fe5e Mon Sep 17 00:00:00 2001 From: Mark Cotton Date: Fri, 14 Jul 2023 12:06:57 -0500 Subject: [PATCH] docker-izing it so it can be deployed --- Dockerfile | 15 +++++++++++++++ docker-compose.yaml | 13 +++++++++++++ requirements.txt | 3 +++ startup.sh | 4 ++++ wsgi.py | 4 ++++ 5 files changed, 39 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100755 startup.sh create mode 100644 wsgi.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6395d1b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ + +FROM python:3.9-slim + +COPY ./requirements.txt /app/requirements.txt + +WORKDIR /app + +RUN apt update + +RUN pip install --upgrade pip + +RUN pip install -r requirements.txt + + +CMD [ "./startup.sh" ] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..750df43 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +version: '3' + +services: + app: + build: . + volumes: + - .:/app + ports: + - "9300:3000" + restart: always + tty: true + user: 1000:1000 + diff --git a/requirements.txt b/requirements.txt index 93adf52..5168cd3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,6 @@ pytz==2023.3 requests==2.29.0 urllib3==1.26.16 Werkzeug==2.3.6 +gunicorn==20.1.0 +cachelib==0.10.2 +Flask-Session==0.5.0 diff --git a/startup.sh b/startup.sh new file mode 100755 index 0000000..9fd0395 --- /dev/null +++ b/startup.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +#python3 -u server.py +gunicorn --bind 0.0.0.0:3000 --limit-request-line 0 --worker-class=gthread --threads=4 wsgi:app diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..6026b0f --- /dev/null +++ b/wsgi.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == "__main__": + app.run()