File size: 1,112 Bytes
06fac16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d87aabb
 
 
 
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
32
33
# Use an official Python runtime as a parent image
# Using a slim image reduces the final size
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /code

# Install system dependencies
# - Update apt package list
# - Install ffmpeg (essential for the application) and git (often useful for pip installs)
# - Clean up apt cache to reduce image size
RUN apt-get update && \
    apt-get install -y --no-install-recommends ffmpeg git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy the requirements file into the container at /code
# Copying this separately allows Docker to cache the pip install layer
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
# --no-cache-dir reduces image size by not storing the pip cache
# --upgrade pip ensures the latest pip is used
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code (app.py) into the container at /code
COPY app.py .


EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]