Update Dockerfile
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
|
@@ -11,6 +11,15 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
# Set working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Copy requirements first for better caching
|
| 15 |
COPY requirements.txt .
|
| 16 |
|
|
@@ -21,14 +30,15 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 21 |
COPY . .
|
| 22 |
|
| 23 |
# Create temp directory for processing
|
| 24 |
-
RUN mkdir -p /tmp/whisper_temp
|
|
|
|
| 25 |
|
| 26 |
# Expose port
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
# Health check
|
| 30 |
-
HEALTHCHECK --interval=30s --timeout=30s --start-period=
|
| 31 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 32 |
|
| 33 |
-
# Run the application
|
| 34 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "
|
|
|
|
| 11 |
# Set working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Create cache directory with proper permissions
|
| 15 |
+
RUN mkdir -p /tmp/huggingface_cache && \
|
| 16 |
+
chmod 777 /tmp/huggingface_cache
|
| 17 |
+
|
| 18 |
+
# Set environment variables for cache
|
| 19 |
+
ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
|
| 20 |
+
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface_cache
|
| 21 |
+
ENV HF_HOME=/tmp/huggingface_cache
|
| 22 |
+
|
| 23 |
# Copy requirements first for better caching
|
| 24 |
COPY requirements.txt .
|
| 25 |
|
|
|
|
| 30 |
COPY . .
|
| 31 |
|
| 32 |
# Create temp directory for processing
|
| 33 |
+
RUN mkdir -p /tmp/whisper_temp && \
|
| 34 |
+
chmod 777 /tmp/whisper_temp
|
| 35 |
|
| 36 |
# Expose port
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
# Health check
|
| 40 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 \
|
| 41 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 42 |
|
| 43 |
+
# Run the application with longer timeout for model loading
|
| 44 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "600", "--workers", "1", "--threads", "4", "--preload", "app:app"]
|