Update Dockerfile
Browse files- Dockerfile +11 -4
Dockerfile
CHANGED
|
@@ -1,19 +1,26 @@
|
|
| 1 |
FROM python:3.12
|
| 2 |
|
| 3 |
-
|
| 4 |
-
RUN mkdir -p /
|
| 5 |
|
| 6 |
WORKDIR /code
|
| 7 |
-
RUN chmod -R 777 /code
|
| 8 |
|
|
|
|
| 9 |
COPY ./requirements.txt /code/requirements.txt
|
| 10 |
|
|
|
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
python3-pyaudio \
|
| 13 |
portaudio19-dev
|
| 14 |
|
| 15 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.12
|
| 2 |
|
| 3 |
+
# Create necessary directories
|
| 4 |
+
RUN mkdir -p /app/cache /.cache /code
|
| 5 |
|
| 6 |
WORKDIR /code
|
|
|
|
| 7 |
|
| 8 |
+
# Copy requirements and install dependencies
|
| 9 |
COPY ./requirements.txt /code/requirements.txt
|
| 10 |
|
| 11 |
+
# Install portaudio and necessary dependencies only if needed
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
python3-pyaudio \
|
| 14 |
portaudio19-dev
|
| 15 |
|
| 16 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 17 |
|
| 18 |
+
# Pre-download models (optional step to avoid runtime downloads)
|
| 19 |
+
RUN pip install torch torchvision torchaudio
|
| 20 |
+
RUN python -c "import torch; torch.hub.load('snakers4/silero-vad', 'silero_vad', trust_repo=True)"
|
| 21 |
+
|
| 22 |
+
# Copy the rest of the app code
|
| 23 |
COPY . .
|
| 24 |
|
| 25 |
+
# Ensure the app uses the correct port and use multiple workers for better handling
|
| 26 |
+
CMD ["uvicorn", "run:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2", "--reload"]
|