diff --git a/Dockerfile b/Dockerfile index 1dee00e..ff5d216 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ RUN pip install torch --index-url https://download.pytorch.org/whl/cpu EXPOSE 8002 -CMD ["gunicorn", "app.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4", "--loop", "uvloop"] +CMD ["gunicorn", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4"] diff --git a/app/main.py b/app/main.py index ce87d0b..8c0c7d6 100644 --- a/app/main.py +++ b/app/main.py @@ -7,6 +7,7 @@ from fastapi.middleware.cors import CORSMiddleware from app.api import routes from app.core.config import settings from app.core.cache import cache +import uvicorn # Настройка логирования logging.basicConfig(level=logging.INFO) @@ -46,3 +47,12 @@ async def global_exception_handler(request: Request, exc: Exception): status_code=500, content={"detail": "Внутренняя ошибка сервера."}, ) + + +if __name__ == "__main__": + uvicorn.run( + "app.main:app", + host="0.0.0.0", + port=8082, + loop="uvloop" + ) \ No newline at end of file diff --git a/app/requirements.txt b/app/requirements.txt index a879e08..e2d0ba2 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,5 +1,6 @@ fastapi uvicorn[standard] +uvloop transformers gunicorn redis>=4.0