| # Use an official Python runtime as a parent image | |
| # We use the full image to ensure all AI/OpenCV dependencies are compatible | |
| FROM python:3.10 | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # Install system dependencies for OpenCV, AI models, and Font Rendering | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| fontconfig \ | |
| libfontconfig1 \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| libasound2 \ | |
| fonts-dejavu-core \ | |
| fonts-liberation \ | |
| fonts-noto-core \ | |
| fonts-noto-extra \ | |
| fonts-noto-color-emoji \ | |
| libraqm0 \ | |
| libfreetype6 \ | |
| libfribidi0 \ | |
| libharfbuzz0b \ | |
| libprotobuf-dev \ | |
| protobuf-compiler \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Download high-quality fonts to bypass Git LFS issues | |
| RUN mkdir -p assets && \ | |
| wget -O assets/tahomabd.ttf "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/tahomabd.ttf" && \ | |
| wget -O assets/TYBAH.TTF "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/TYBAH.TTF" && \ | |
| wget -O assets/arialbd.ttf "https://raw.githubusercontent.com/Esmaill1/color-stealer/main/arialbd.ttf" | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| # We use --no-cache-dir to keep the image small | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Expose port 7860 for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Run the server | |
| CMD ["python", "web/server.py"] | |