v2
This commit is contained in:
41
Dockerfile
41
Dockerfile
@@ -1,19 +1,46 @@
|
||||
FROM python:3.10-slim
|
||||
# Base image
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# Install dependencies
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
python3 \
|
||||
python3-pip \
|
||||
git \
|
||||
cmake \
|
||||
make \
|
||||
g++ \
|
||||
ffmpeg \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Clone whisper.cpp and compile
|
||||
RUN git clone https://github.com/ggerganov/whisper.cpp.git && \
|
||||
cd whisper.cpp && \
|
||||
make
|
||||
|
||||
# Download the small.en model
|
||||
RUN cd whisper.cpp/models && \
|
||||
curl -L "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en.bin" --output ggml-small.en.bin
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy app and model
|
||||
COPY app ./app
|
||||
# Copy API code
|
||||
COPY app.py .
|
||||
|
||||
# Create uploads directory
|
||||
RUN mkdir -p uploads
|
||||
|
||||
# Environment variables (adjust paths if needed)
|
||||
ENV WHISPER_CPP_PATH="/app/whisper.cpp/main"
|
||||
ENV MODEL_PATH="/app/whisper.cpp/models/ggml-small.en.bin"
|
||||
|
||||
# Expose Flask port
|
||||
EXPOSE 4002
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "4002"]
|
||||
|
||||
# Run the API
|
||||
CMD ["python3", "app.py"]
|
||||
|
||||
Reference in New Issue
Block a user