vid-test / Dockerfile
sdafd's picture
Update Dockerfile
d87aabb verified
# 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"]