esmaill1
feat: implement image processing core, FastAPI backend, and full-stack integration tests
f19ba0f | # 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 up a new user named "user" with UID 1000 to comply with Hugging Face Spaces requirements | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory in the container | |
| WORKDIR $HOME/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 --chown=user 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 --user -r requirements.txt | |
| # Copy the rest of the application code and set ownership to user 1000 | |
| COPY --chown=user . . | |
| # Expose port 7860 for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Run the server | |
| CMD ["python", "main.py"] | |