toxic-detector/Dockerfile

24 lines
737 B
Docker
Raw Normal View History

2024-10-22 22:51:03 +02:00
# Dockerfile
FROM python:3.11-alpine
# Установка системных зависимостей
RUN apk update && apk add --no-cache \
build-base \
libffi-dev \
openssl-dev \
&& rm -rf /var/cache/apk/*
2024-10-22 23:06:16 +02:00
COPY app /app
2024-10-22 22:51:03 +02:00
# Установка зависимостей
RUN pip install --upgrade pip
2024-10-22 23:06:16 +02:00
RUN pip install --no-cache-dir -r app/requirements.txt
2024-10-22 22:57:23 +02:00
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
2024-10-22 22:51:03 +02:00
# Экспонирование порта
2024-10-22 22:54:00 +02:00
EXPOSE 8002
2024-10-22 22:51:03 +02:00
# Команда запуска приложения с использованием Gunicorn и Uvicorn workers
2024-10-22 22:54:00 +02:00
CMD ["gunicorn", "main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4"]