Video_model / Dockerfile
DegenGamer1702's picture
Update Dockerfile
969f04d verified
Raw
History Blame Contribute Delete
1.9 kB
# =======================================================
# GPU-enabled base image (CUDA 12.1 + cuDNN 8)
# =======================================================
FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# =======================================================
# Install Gradio first (pinned version)
# =======================================================
ARG GRADIO_FORCE_REINSTALL=1
RUN pip install --no-cache-dir --upgrade gradio==4.44.1
# =======================================================
# System dependencies for OpenCV + dlib runtime
# =======================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# =======================================================
# Copy application files
# =======================================================
COPY requirements.txt /app/requirements.txt
COPY app.py /app/app.py
COPY models /app/models
COPY shape_predictor_68_face_landmarks.dat /app/
# =======================================================
# Install Python dependencies
# =======================================================
RUN pip install --no-cache-dir tensorflow==2.18.0
RUN pip install --no-cache-dir -r requirements.txt
# 🔧 Replace compiled dlib with prebuilt dlib-bin
RUN pip uninstall -y dlib || true \
&& pip install --no-cache-dir dlib-bin==19.24.2
# =======================================================
# Environment optimizations
# =======================================================
ENV OMP_NUM_THREADS=2 \
MKL_NUM_THREADS=2 \
OPENBLAS_NUM_THREADS=2 \
NUMEXPR_NUM_THREADS=2 \
TF_CPP_MIN_LOG_LEVEL=2 \
CUDA_VISIBLE_DEVICES=0
EXPOSE 7860
CMD ["python", "app.py"]