37 lines
1.3 KiB
Docker
37 lines
1.3 KiB
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.10-slim
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies required by some Python packages
|
|
# ffmpeg is crucial for audio/video processing
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy the requirements file into the container at /app
|
|
COPY requirements.txt .
|
|
|
|
# Install any needed packages specified in requirements.txt
|
|
# This command will install the GPU version of PyTorch if the base image has CUDA support
|
|
# and the host machine has NVIDIA drivers. Otherwise, it can be adapted for CPU.
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the rest of the application's code into the container
|
|
COPY . .
|
|
|
|
# Make port 12000 available to the world outside this container
|
|
# This is the port the app will run on, as defined in the .env file
|
|
EXPOSE 12000
|
|
|
|
# Define environment variable to ensure python outputs everything without buffering
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
# Run app.py when the container launches
|
|
# Use Gunicorn for a production-ready WSGI server
|
|
# The command will be specified in docker-compose.yml to allow for different entrypoints
|
|
# for the web server and celery worker.
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:12000", "app:app"]
|