31 lines
886 B
Docker
31 lines
886 B
Docker
|
# Dockerfile
|
|||
|
|
|||
|
FROM python:3.11-alpine
|
|||
|
|
|||
|
# Установка системных зависимостей
|
|||
|
RUN apk update && apk add --no-cache \
|
|||
|
build-base \
|
|||
|
libffi-dev \
|
|||
|
openssl-dev \
|
|||
|
&& rm -rf /var/cache/apk/*
|
|||
|
|
|||
|
# Установка зависимостей Python
|
|||
|
COPY app/requirements.txt /app/requirements.txt
|
|||
|
WORKDIR /app
|
|||
|
|
|||
|
# Установка зависимостей
|
|||
|
RUN pip install --upgrade pip
|
|||
|
RUN pip install --no-cache-dir -r requirements.txt
|
|||
|
|
|||
|
# Копирование исходного кода
|
|||
|
COPY app /app
|
|||
|
|
|||
|
# Экспонирование порта
|
|||
|
EXPOSE 8000
|
|||
|
|
|||
|
# Установка Gunicorn
|
|||
|
RUN pip install gunicorn
|
|||
|
|
|||
|
# Команда запуска приложения с использованием Gunicorn и Uvicorn workers
|
|||
|
CMD ["gunicorn", "main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--workers", "4"]
|