# Use nvidia/cuda as base image with Python FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 # Use args ARG USE_CUDA ARG USE_CUDA_VER ## Basis ## ENV ENV=prod \ PORT=8000 \ USE_CUDA_DOCKER=${USE_CUDA} \ USE_CUDA_DOCKER_VER=${USE_CUDA_VER} # Install GCC and build tools RUN apt-get update && \ apt-get install -y gcc build-essential curl git pkg-config libicu-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN apt-get update -y && apt-get install -y python3-pip # Set working directory WORKDIR /app # Copy the requirements.txt file and install dependencies COPY ./requirements.txt . # Install dependencies RUN pip install uv && \ if [ "$USE_CUDA" = "true" ]; then \ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir; \ else \ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir; \ fi # Copy faster-whisper-main folder and install COPY ./faster-whisper-main ./faster-whisper-main RUN pip install ./faster-whisper-main --no-cache-dir RUN pip install --no-cache-dir -r requirements.txt # Copy the remaining application code COPY . . # Expose the API port EXPOSE 8000 # Set the environment variables ENV HOST="0.0.0.0" ENV PORT="8000" # Set entrypoint to run the FastAPI server ENTRYPOINT ["bash", "start.sh"]