synapse-x / Dockerfile
Nithin1026's picture
final update-1
2e6a03e
Raw
History Blame Contribute Delete
894 Bytes
FROM python:3.11-slim
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies first (layer cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project
COPY . .
EXPOSE 7860
# Runtime environment variables
# HF_TOKEN must be supplied at runtime as a Space Secret — never hardcoded here.
ENV PORT=7860 \
API_BASE_URL="https://router.huggingface.co/v1" \
MODEL_NAME="meta-llama/Meta-Llama-3-8B-Instruct" \
LOCAL_IMAGE_NAME="synapse-x"
# Health-check so HF Spaces detects readiness
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD sh -c 'curl -sf "http://127.0.0.1:${PORT:-7860}/health" || exit 1'
CMD ["sh", "-c", "uvicorn server.app:app --host 0.0.0.0 --port ${PORT:-7860}"]