Update Dockerfile
Browse files- Dockerfile +13 -2
Dockerfile
CHANGED
|
@@ -11,8 +11,19 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
make \
|
| 12 |
libffi-dev \
|
| 13 |
libssl-dev \
|
|
|
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Copy requirements first for better caching
|
| 17 |
COPY requirements.txt .
|
| 18 |
|
|
@@ -35,8 +46,8 @@ ENV PORT=7860
|
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
# Health check
|
| 38 |
-
HEALTHCHECK --interval=30s --timeout=30s --start-period=
|
| 39 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 40 |
|
| 41 |
# Command to run the application
|
| 42 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "
|
|
|
|
| 11 |
make \
|
| 12 |
libffi-dev \
|
| 13 |
libssl-dev \
|
| 14 |
+
curl \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# Create cache directories with proper permissions
|
| 18 |
+
RUN mkdir -p /tmp/transformers_cache /tmp/hf_cache && \
|
| 19 |
+
chmod 777 /tmp/transformers_cache /tmp/hf_cache
|
| 20 |
+
|
| 21 |
+
# Set environment variables for caching
|
| 22 |
+
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
| 23 |
+
ENV HF_HOME=/tmp/hf_cache
|
| 24 |
+
ENV TRANSFORMERS_OFFLINE=0
|
| 25 |
+
ENV HF_DATASETS_OFFLINE=0
|
| 26 |
+
|
| 27 |
# Copy requirements first for better caching
|
| 28 |
COPY requirements.txt .
|
| 29 |
|
|
|
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
# Health check
|
| 49 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 \
|
| 50 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 51 |
|
| 52 |
# Command to run the application
|
| 53 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "300", "--worker-class", "sync", "--preload", "app:app"]
|