captcha-solver-api / Dockerfile
ballagb19's picture
Upload Dockerfile with huggingface_hub
9b6bfae verified
Raw
History Blame Contribute Delete
899 Bytes
FROM python:3.12-slim
# System deps for Pillow + audio + tesseract
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libjpeg-dev \
zlib1g-dev \
libpng-dev \
ffmpeg \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
# Working dir
WORKDIR /app
# Install Python deps first (better caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy code
COPY captcha_solver/ ./captcha_solver/
COPY scripts/ ./scripts/
# Expose port (HF Spaces uses PORT env var, default 7860)
ENV PORT=7860
EXPOSE ${PORT}
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:${PORT:-7860}/health', timeout=5).raise_for_status()" || exit 1
# Run with configurable port
CMD sh -c "python -m captcha_solver.main --port ${PORT:-7860}"