From ed57c15387f4f3e4087c0ed53f06c5ce3f8095d2 Mon Sep 17 00:00:00 2001 From: Stedoss Date: Sun, 3 Nov 2024 17:36:59 +0000 Subject: [PATCH] Use `__main__` instead of `sanic` command to avoid docker incompat --- nise-circleguard/Dockerfile | 7 +------ nise-circleguard/src/main.py | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/nise-circleguard/Dockerfile b/nise-circleguard/Dockerfile index 93ba737..07a656c 100644 --- a/nise-circleguard/Dockerfile +++ b/nise-circleguard/Dockerfile @@ -5,8 +5,6 @@ ENV PYTHONPATH=/app WORKDIR /app -RUN apt update - COPY requirements.txt ./requirements.txt RUN pip3 install --no-cache-dir -r requirements.txt @@ -21,9 +19,6 @@ RUN sed -i '238s|return \[x for x in arr if lower_limit < x < upper_limit\]|arr_ COPY ./src/ ./src/ -ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0:5000 --workers=16" - WORKDIR /app/src -# Run gunicorn with the application -CMD ["sanic", "main", "--port=5000"] +CMD ["python", "main.py"] diff --git a/nise-circleguard/src/main.py b/nise-circleguard/src/main.py index faeaf15..f27ad24 100644 --- a/nise-circleguard/src/main.py +++ b/nise-circleguard/src/main.py @@ -291,3 +291,6 @@ async def process_similarity(request: Request): except ValueError as e: raise exceptions.BadRequest(str(e)) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=5000) \ No newline at end of file