Use __main__ instead of sanic command to avoid docker incompat

This commit is contained in:
Stedoss 2024-11-03 17:36:59 +00:00
parent 67150e7e42
commit ed57c15387
2 changed files with 4 additions and 6 deletions

View File

@ -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"]

View File

@ -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)