# Customs Compass — Hugging Face Spaces Docker image # Bundles Ollama + Streamlit + the llama3.2:1b model so the deployed app # has full LLM features (not just template fallback). FROM python:3.11-slim # ---- System dependencies ---- RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ bash \ procps \ && rm -rf /var/lib/apt/lists/* # ---- Install Ollama ---- RUN curl -fsSL https://ollama.com/install.sh | sh # ---- Set up the app ---- WORKDIR /app # Install Python dependencies first (better Docker layer caching) COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r /app/requirements.txt # Pre-pull the model at build time so the container starts fast for users. # llama3.2:1b is ~1.3 GB — small enough for HF Spaces free tier and fast # enough on CPU to give responses in 10-25s instead of 60-90s. RUN ollama serve & \ OLLAMA_PID=$! && \ sleep 5 && \ ollama pull llama3.2:1b && \ kill $OLLAMA_PID || true # Copy the rest of the application COPY . /app # Make sure the entrypoint is executable RUN chmod +x /app/entrypoint.sh # Hugging Face Spaces expects the app on port 7860 ENV PORT=7860 ENV OLLAMA_HOST=0.0.0.0 ENV OLLAMA_URL=http://localhost:11434 ENV OLLAMA_MODEL=llama3.2:1b ENV OLLAMA_KEEP_ALIVE=15m EXPOSE 7860 ENTRYPOINT ["/app/entrypoint.sh"]