Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
|
| 3 |
+
# System deps for Pillow + audio + tesseract
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
build-essential \
|
| 6 |
+
libjpeg-dev \
|
| 7 |
+
zlib1g-dev \
|
| 8 |
+
libpng-dev \
|
| 9 |
+
ffmpeg \
|
| 10 |
+
tesseract-ocr \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Working dir
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Install Python deps first (better caching)
|
| 17 |
+
COPY requirements.txt .
|
| 18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy code
|
| 21 |
+
COPY captcha_solver/ ./captcha_solver/
|
| 22 |
+
COPY scripts/ ./scripts/
|
| 23 |
+
|
| 24 |
+
# Expose port (HF Spaces uses PORT env var, default 7860)
|
| 25 |
+
ENV PORT=7860
|
| 26 |
+
EXPOSE ${PORT}
|
| 27 |
+
|
| 28 |
+
# Healthcheck
|
| 29 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
|
| 30 |
+
CMD python -c "import httpx; httpx.get('http://localhost:${PORT:-7860}/health', timeout=5).raise_for_status()" || exit 1
|
| 31 |
+
|
| 32 |
+
# Run with configurable port
|
| 33 |
+
CMD sh -c "python -m captcha_solver.main --port ${PORT:-7860}"
|