captcha_filler / Dockerfile
lakshraina2's picture
Update Dockerfile
cedf46e verified
FROM python:3.9-slim
# 1. Install system dependencies for OpenCV (Updated for newer Debian versions)
RUN apt-get update && apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev libgl1 && rm -rf /var/lib/apt/lists/*
# 2. Create the strict non-root user Hugging Face requires
RUN useradd -m -u 1000 user
USER user
# 3. Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
# 4. Set working directory
WORKDIR $HOME/app
# 5. Copy files and set ownership
COPY --chown=user . $HOME/app
# 6. Install Python requirements
RUN pip install --no-cache-dir -r requirements.txt
# 7. Start the Uvicorn server
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]