Spaces:
Sleeping
Sleeping
File size: 1,002 Bytes
9d27b5e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # Use Python 3.10 slim image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY symptom_checker.py .
COPY api_server.py .
# Copy model artifacts
COPY symptom_model.json .
COPY symptom_model.labels.npy .
COPY symptom_model.features.txt .
# Expose port (Hugging Face Spaces uses port 7860)
EXPOSE 7860
# Create a non-root user for security
RUN useradd -m -u 1000 appuser
USER appuser
# Run the FastAPI server
CMD ["uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "7860"]
|