tinyml-backend / Dockerfile
IDKHowToCodeFr's picture
Upload folder using huggingface_hub
604d53b verified
Raw History Blame
720 Bytes
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies if required by any ML libraries
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install python dependencies from the backend
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all necessary files and directories
COPY . .
# Hugging Face Spaces mandates port 7860; can be overridden via PORT env var
EXPOSE 7860
EXPOSE 8000
# Ensure Python knows where to find the backend module
ENV PYTHONPATH=/app
# Start the FastAPI server with dynamic port support
CMD ["sh", "-c", "uvicorn backend.main:app --host 0.0.0.0 --port ${PORT:-7860}"]