JustForWorld's picture
revert: to the b814393 and upgrade guidance_scale=3.8 and strength=0.6
4790b3f
Raw
History Blame Contribute Delete
2.41 kB
# ============================================
# Базовый образ: CUDA 12.1 + Ubuntu 22.04
# ============================================
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
# ============================================
# Переменные окружения
# ============================================
ENV PIP_CACHE_DIR=/data/.cache/pip \
HF_HOME=/data/.cache/huggingface \
OMP_NUM_THREADS=4 \
MAX_JOBS=1 \
FORCE_CUDA=1 \
PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive
# ============================================
# Установка системных пакетов и Python 3.11
# ============================================
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
libgl1 \
libglib2.0-0 \
espeak-ng \
build-essential \
python3.11 \
python3.11-venv \
python3-pip \
python3.11-dev \
ninja-build \
&& rm -rf /var/lib/apt/lists/* \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
&& update-alternatives --set python3 /usr/bin/python3.11
WORKDIR /app
# ============================================
# Обновление pip и установка PyTorch с CUDA 12.1
# ============================================
RUN python3 -m pip install --upgrade pip setuptools wheel
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# ============================================
# Установка зависимостей Python
# ============================================
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --index-url https://pypi.org/simple
# ============================================
# Копирование приложения
# ============================================
COPY . .
# ============================================
# Создание пользователя без root-доступа
# ============================================
RUN useradd -m -u 1000 appuser && mkdir -p /data/.cache && chown -R appuser:appuser /app /data
USER appuser
# ============================================
# Порт и запуск приложения
# ============================================
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]