Download Dockerfile from balkotjokes/property-classification: direct link, hf CLI and curl.
- Browser
- Download file 2.79 kB
-
https://huggingface.co/balkotjokes/property-classification/resolve/main/Dockerfile
- Command line
-
hf download hf://balkotjokes/property-classification/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/balkotjokes/property-classification/resolve/main/Dockerfile
2.79 kB
| # ββ Base: Python 3.10 on slim Debian ββββββββββββββββββββββββββββββββββββββ | |
| # python:3.10-slim is critical: | |
| # - Python 3.13 (HF default) removed audioop β gradio/pydub crash | |
| # - Python 3.10 has audioop built-in and is TF 2.15 compatible | |
| FROM python:3.10-slim | |
| # ββ Working directory ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| WORKDIR /app | |
| # ββ System dependencies ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # libgomp1: required by TensorFlow for OpenMP multi-threading | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends libgomp1 && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # ββ Python dependencies ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # numpy MUST be installed before tensorflow β TF checks numpy at install time | |
| # Each on separate RUN so Docker caches each layer independently | |
| # If you change app.py later, packages won't reinstall (fast rebuild) | |
| RUN pip install --no-cache-dir "numpy==1.26.4" | |
| # tensorflow-cpu: CPU-only build (~500MB) β HF Spaces has no GPU | |
| RUN pip install --no-cache-dir "tensorflow-cpu==2.15.0" | |
| # FastAPI stack β lightweight web server, no gradio dependency hell | |
| RUN pip install --no-cache-dir \ | |
| "fastapi==0.110.0" \ | |
| "uvicorn[standard]==0.29.0" \ | |
| "python-multipart==0.0.9" \ | |
| "pillow==10.3.0" \ | |
| "h5py==3.11.0" | |
| # ββ Copy application files βββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY app.py . | |
| # Copy model files (must exist before building image or uploading to HF) | |
| COPY models/ ./models/ | |
| # ββ Runtime config βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Suppress TensorFlow C++ verbose logs | |
| ENV TF_CPP_MIN_LOG_LEVEL=3 | |
| ENV TF_ENABLE_ONEDNN_OPTS=0 | |
| # HF Spaces routes external traffic to this port | |
| EXPOSE 7860 | |
| # ββ Start command ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # uvicorn serves FastAPI directly β no gradio server check, no localhost issues | |
| CMD ["uvicorn", "app:app", \ | |
| "--host", "0.0.0.0", \ | |
| "--port", "7860", \ | |
| "--workers", "1", \ | |
| "--log-level", "info"] | |