# Use Python base image FROM python:3.12.2 # Add a new user but do not switch yet RUN useradd -m -u 1000 user # Set working directory WORKDIR /app # Copy application code with correct ownership COPY --chown=user . /app/ USER root RUN apt-get update && apt-get install git -y RUN pip3 install "git+https://github.com/openai/whisper.git" RUN apt-get update && apt-get install -y ffmpeg # Install Python dependencies RUN pip install --no-cache-dir -U pip setuptools wheel RUN pip install --no-cache-dir setuptools-rust RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir -r requirements.txt # Environment variables for PyTorch and Whisper ENV TORCH_DEVICE="cuda" ENV FORCE_FP32="false" # Expose port EXPOSE 7860 # Start the FastAPI application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "5"]