This commit is contained in:
itqop 2024-10-23 01:20:53 +03:00
parent 623be62342
commit 755053d7e9
2 changed files with 1 additions and 7 deletions

View File

@ -1,8 +1,5 @@
# Dockerfile
FROM python:3.11-slim FROM python:3.11-slim
# Установка системных зависимостей
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \ build-essential \
libffi-dev \ libffi-dev \
@ -11,13 +8,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY app /app COPY app /app
# Установка зависимостей
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install -r app/requirements.txt RUN pip install -r app/requirements.txt
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
# Экспонирование порта
EXPOSE 8002 EXPOSE 8002
# Команда запуска приложения с использованием Gunicorn и Uvicorn workers
CMD ["gunicorn", "app.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4"] CMD ["gunicorn", "app.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4"]

View File

@ -6,7 +6,7 @@ services:
- "8002:8002" - "8002:8002"
environment: environment:
- MODEL_CHECKPOINT=cointegrated/rubert-tiny-toxicity - MODEL_CHECKPOINT=cointegrated/rubert-tiny-toxicity
- USE_CUDA=False # Установите True, если используете GPU и это поддерживается - USE_CUDA=False
- REDIS_URL=redis://redis:6379/0 - REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0