CoolFace
Apppublic

tchawla827/spam-classifier-api

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
Dockerfile39 linesDownload Raw Back to root
1# Hugging Face Spaces deployment2# ── Stage 1: dependency builder ────────────────────────────────────────────────3FROM python:3.11-slim AS builder4 5WORKDIR /build6 7COPY apps/api/requirements/base.txt requirements.txt8RUN pip install --no-cache-dir --user -r requirements.txt9 10# ── Stage 2: runtime ───────────────────────────────────────────────────────────11FROM python:3.11-slim AS runtime12 13RUN apt-get update && apt-get install -y --no-install-recommends curl libgomp1 && rm -rf /var/lib/apt/lists/*14 15WORKDIR /app16 17COPY --from=builder /root/.local /root/.local18COPY apps/api/app ./app19COPY apps/api/alembic.ini ./alembic.ini20COPY apps/api/alembic ./alembic21COPY ml/src ./ml/src22COPY apps/api/start.sh ./start.sh23RUN chmod +x ./start.sh24 25RUN mkdir -p ml/artifacts && \26    curl -L -o /tmp/ml-bundle.tar.gz https://huggingface.co/tchawla827/email-spam-classifier/resolve/main/ml-bundle.tar.gz && \27    tar -xzf /tmp/ml-bundle.tar.gz -C ml/artifacts/ --no-same-owner && \28    rm -f /tmp/ml-bundle.tar.gz29 30ENV PATH=/root/.local/bin:$PATH31ENV PYTHONPATH=/app32ENV ARTIFACT_BUNDLE_DIR=ml/artifacts/bundle33# HF Spaces requires port 786034ENV PORT=786035 36EXPOSE 786037 38CMD ["./start.sh"]39