# Use an official Python runtime as the base image
FROM python:3.9-slim-buster

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY ./requirements.txt /app/requirements.txt

# Install the Python dependencies
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Copy the current directory contents into the container 
COPY . /app/

# Expose the port that FastAPI app will run on
EXPOSE 6000 

# Start the FastAPI app on port 7860, the default port expected by Spaces
CMD ["python", "/app/app.py"]