Aoun-Ai / Dockerfile
MuhammadMahmoud's picture
feat: clean deployment with bug fixes and stability improvements
18b8b90
raw
history blame contribute delete
940 Bytes
# Use an official lightweight Python image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
# Install system dependencies needed for scikit-learn/xgboost compilation
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
# Create a non-root user (Hugging Face requires UID 1000)
RUN useradd -m -u 1000 user
USER user
WORKDIR $HOME/app
# Copy requirements and install
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the rest of the application
# We copy everything except what's in .dockerignore (or just specify directories)
COPY --chown=user . .
# Expose the mandatory port for Hugging Face Spaces
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]