# Use a Python 3.10 Slim image as the base FROM python:3.10-slim # Set the working directory WORKDIR /code # Install virtualenv to create a virtual environment RUN pip install --no-cache-dir virtualenv # Create and activate the virtual environment RUN python -m venv /code/venv # Ensure the virtual environment is used for subsequent pip installations ENV PATH="/code/venv/bin:$PATH" # Copy the requirements file to the container COPY ./requirements.txt /code/requirements.txt # Install dependencies inside the virtual environment RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r /code/requirements.txt # Copy the rest of the project files into the container COPY . . # Set the default command to run your application (inside the virtual environment) CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]