File size: 731 Bytes
ad7f48c |
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 |
# Step 1: Use an official Python image as a base
FROM python:3.11-slim
# Step 2: Set the working directory in the container
WORKDIR /app
# Step 3: Copy the requirements.txt file to the working directory
COPY requirements.txt /app/
# Step 4: Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Step 5: Copy the rest of the application code
COPY . /app/
# Step 6: Expose the port the app will run on
EXPOSE 7860
# Step 7: Set environment variable (if you need .env file handling)
# You can optionally copy the .env file if you're using it for environment variables
# COPY .env /app/
# Step 8: Run the application using uvicorn (FastAPI)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|