hvac_fable / Dockerfile
Rachel7's picture
Deploy Fable B-test analyzer
dac3297 verified
Raw History Blame Contribute Delete
1.23 kB
# Hugging Face Spaces (Docker SDK) image for the HVAC Blueprint Analyzer.
# Free CPU tier = 2 vCPU / 16 GB RAM, which comfortably fits the ~4 GB the
# engine needs at 300 DPI (the thing Railway kept OOM-killing).
FROM python:3.11-slim
# System packages the Python wheels can't bring in themselves:
# tesseract-ocr -> binary pytesseract shells out to (schedule OCR)
# libglib2.0-0 -> OpenCV (even headless) needs libgthread/glib
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces run the container as uid 1000; give it a home + writable app dir.
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
WORKDIR /app
# Install deps first (better layer caching). No venv: the engine subprocess
# uses sys.executable, so deps must be on the global interpreter.
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the app and hand ownership to the runtime user.
COPY . .
RUN chown -R user:user /app
USER user
# HF Spaces expects the app on port 7860.
EXPOSE 7860
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]