fix : Dockerfile
Browse files- Dockerfile +12 -6
- requirements.txt +13 -10
Dockerfile
CHANGED
|
@@ -1,16 +1,19 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
COPY ./requirements.txt /code/requirements.txt
|
| 7 |
-
|
| 8 |
-
# Install system dependencies for audio processing
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
ffmpeg \
|
| 11 |
libsndfile1 \
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Install Python dependencies
|
| 15 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 16 |
|
|
@@ -30,5 +33,8 @@ COPY . .
|
|
| 30 |
# Grant write permissions to the directory where your application saves files
|
| 31 |
RUN mkdir -p /code/static/uploads && chmod -R 777 /code/static/uploads
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
# Command to run your application
|
| 34 |
-
CMD ["gunicorn", "--timeout", "300", "-b", "0.0.0.0:7860", "app:app"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
ffmpeg \
|
| 10 |
libsndfile1 \
|
| 11 |
+
build-essential \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Copy requirements.txt separately to leverage Docker layer caching
|
| 15 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 16 |
+
|
| 17 |
# Install Python dependencies
|
| 18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 19 |
|
|
|
|
| 33 |
# Grant write permissions to the directory where your application saves files
|
| 34 |
RUN mkdir -p /code/static/uploads && chmod -R 777 /code/static/uploads
|
| 35 |
|
| 36 |
+
# Expose the port the app runs on
|
| 37 |
+
EXPOSE 7860
|
| 38 |
+
|
| 39 |
# Command to run your application
|
| 40 |
+
CMD ["gunicorn", "--timeout", "300", "--workers", "2", "--threads", "4", "-b", "0.0.0.0:7860", "app:app"]
|
requirements.txt
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
-
flask
|
| 2 |
-
gunicorn
|
| 3 |
-
PyPDF2
|
| 4 |
-
PyMuPDF
|
| 5 |
-
torch
|
| 6 |
-
transformers
|
| 7 |
-
pydub
|
| 8 |
-
whisper
|
| 9 |
-
torchaudio
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
flask==2.0.1
|
| 2 |
+
gunicorn==20.1.0
|
| 3 |
+
PyPDF2==2.10.5
|
| 4 |
+
PyMuPDF==1.19.6
|
| 5 |
+
torch==1.9.0
|
| 6 |
+
transformers==4.11.3
|
| 7 |
+
pydub==0.25.1
|
| 8 |
+
openai-whisper==20230314
|
| 9 |
+
torchaudio==0.9.0
|
| 10 |
+
SoundFile==0.10.3.post1
|
| 11 |
+
numpy==1.21.0
|
| 12 |
+
scikit-learn==0.24.2
|
| 13 |
+
librosa==0.8.1
|