File size: 1,410 Bytes
c3b1078 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# 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"]
|