diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..adf79f5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.8 + +WORKDIR /app + +ADD requirements.txt /app/requirements.txt +RUN pip install -r requirements.txt + +ENTRYPOINT ["python", "app.py"] + +EXPOSE 80 +COPY . /app diff --git a/common.py b/common.py index 25bfbda..156f88f 100644 --- a/common.py +++ b/common.py @@ -1,16 +1,17 @@ import logging import sys +import os from logging import FileHandler, StreamHandler from models import DB config = { - "API_PORT": 3000, - "API_HOST": "0.0.0.0", - "REDIS_HOST": "localhost", - "REDIS_PORT": 6379, - "FLASK_SECRET": "secret!", - "VERBOSE": False, + "API_PORT": int(os.environ.get("BINGO_API_PORT", "3000")), + "API_HOST": os.environ.get("BINGO_API_HOST", "0.0.0.0"), + "REDIS_HOST": os.environ.get("BINGO_REDIS_HOST", "localhost"), + "REDIS_PORT": int(os.environ.get("BINGO_REDIS_PORT", "6379")), + "FLASK_SECRET": os.environ.get("BINGO_FLASK_SECRET", "secret!"), + "VERBOSE": bool(os.environ.get("BINGO_VERBOSE", "True")), } logger = logging.getLogger("default") diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a44f3f8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "2.1" + +services: + bingo: + build: . + ports: + - 3000:80 + environment: + - "BINGO_API_PORT=80" + - "BINGO_API_HOST=0.0.0.0" + - "BINGO_REDIS_PORT=6379" + - "BINGO_REDIS_HOST=redis" + - "BINGO_FLASK_SECRET=changeme" + - "BINGO_VERBOSE=True" + depends_on: + redis: + condition: service_started + restart: always + redis: + image: redis diff --git a/requirements.txt b/requirements.txt index f094d7d..bdb7bb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ flask flask-socketio redis +eventlet \ No newline at end of file