Omkar008's picture
adding the code files
9f559c6 verified
raw
history blame
1.27 kB
# Use Python base image
FROM python:3.12.2
# Prevent timezone prompt during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
git \
curl \
build-essential \
cargo \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust for setuptools-rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Set working directory
WORKDIR /app
# Copy application code
COPY . /app
# Install Python dependencies
RUN pip install --no-cache-dir -U pip setuptools wheel
RUN pip install --no-cache-dir setuptools-rust
RUN pip install --no-cache-dir torch==2.0.1+cu118 torchaudio==2.0.2+cu118 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install --no-cache-dir -r requirements.txt
# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER user
# Ensure ownership of /app directory
COPY --chown=user . /app/
# 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"]