fastapi-hfspace / Dockerfile
aghoraguru's picture
Add Dockerfile and requirements for FastAPI application
c0d6e80
raw
history blame contribute delete
753 Bytes
# Use a lightweight Python image
FROM python:3.9-slim
# Set environment variables to prevent interactive prompts
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Set the working directory
WORKDIR /app
# Copy only necessary files
COPY ./chroma_db /app/chroma_db
COPY main.py /app/main.py
COPY requirements.txt /app/requirements.txt
# Install system-level dependencies (e.g., for Chroma)
RUN apt-get update && apt-get install -y \
build-essential \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --upgrade pip && pip install -r requirements.txt
# Expose port 8000 for FastAPI
EXPOSE 8000
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]