File size: 908 Bytes
9f559c6 1a2fc88 9ae946d 9f559c6 1a2fc88 92c4439 1a2fc88 92c4439 9f559c6 dfdc318 9f559c6 92c4439 9f559c6 1a2fc88 |
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 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"] |