fest / Dockerfile
Ahmad140's picture
Update Dockerfile
e419c13 verified
Raw History Blame Contribute Delete
1.22 kB
# 1. Use pure Ubuntu 22.04 (It has Python 3.10 built-in)
FROM ubuntu:22.04
# Prevent time-zone prompts during install
ENV DEBIAN_FRONTEND=noninteractive
# 2. Install Python, OpenCV dependencies, and PRE-COMPILED dlib directly from Ubuntu!
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dlib \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 3. Setup User for Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# 4. Install TensorFlow, OpenCV, and Gradio normally
RUN pip3 install --no-cache-dir tensorflow-cpu==2.15.0 opencv-python-headless gradio==4.19.2
# 5. Install face_recognition dependencies manually
RUN pip3 install --no-cache-dir numpy Pillow click face_recognition_models
# 6. 🔥 THE ULTIMATE HACK 🔥
# We install face_recognition WITHOUT dependencies (--no-deps).
# This completely stops pip from trying to build or download dlib!
RUN pip3 install --no-cache-dir --no-deps face_recognition
# 7. Copy your files to the container
COPY --chown=user . $HOME/app
# 8. Start the app
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["python3", "app.py"]