File size: 1,082 Bytes
8c40fb8 e4ab92a 8c40fb8 e4ab92a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies that might be needed by some Python packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
# Use --no-cache-dir to keep the image size down
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your application's code into the containe
# This includes your .py file and folders like 'models', 'embeddings', 'Datasets'
COPY . .
# Make port 8000 available to the world outside this container
EXPOSE 7860
# Define the command to run your app using uvicorn
# This will be run when the container starts
# --host 0.0.0.0 is crucial for it to be accessible from outside the container
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|