update Dockerfile

This commit is contained in:
denis 2026-09-18 18:13:44 +03:00
parent 970c49599f
commit 68371f826b
1 changed files with 17 additions and 11 deletions

View File

@ -1,11 +1,19 @@
FROM python:3.10-slim # --- Этап сборки ---
FROM python:3.10-slim AS builder
# Неинтерактивный режим для apt RUN apt-get update && apt-get install -y --no-install-recommends \
ENV DEBIAN_FRONTEND=noninteractive build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt \
--extra-index-url https://download.pytorch.org/whl/cpu
# Системные зависимости для OpenCV и Pillow # --- Финальный этап ---
FROM python:3.10-slim
# Только runtime-библиотеки, без gcc
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \ libgl1 \
libglx-mesa0 \ libglx-mesa0 \
@ -14,20 +22,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxext6 \ libxext6 \
libxrender1 \ libxrender1 \
libgomp1 \ libgomp1 \
wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Python-зависимости WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \ # Копируем установленные пакеты из builder-этапа
--extra-index-url https://download.pytorch.org/whl/cpu COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# Проект
COPY . . COPY . .
RUN mkdir -p models RUN mkdir -p models
EXPOSE 8000 EXPOSE 8000
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app ENV PYTHONPATH=/app