Update Dockerfile
Browse files- Dockerfile +10 -4
Dockerfile
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
ENV PYTHONUNBUFFERED=1
|
4 |
-
|
|
|
5 |
ENV UPLOAD_DIR=/app/uploads
|
|
|
6 |
ENV PORT=7860
|
7 |
|
8 |
# Install system dependencies
|
@@ -16,8 +18,8 @@ RUN apt-get update && \
|
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
# Create directories and set permissions
|
19 |
-
RUN mkdir -p /app/cache /app/uploads /app/static /app/images && \
|
20 |
-
chmod -R 777 /app
|
21 |
|
22 |
WORKDIR /app
|
23 |
|
@@ -26,6 +28,10 @@ COPY requirements.txt .
|
|
26 |
RUN pip install --no-cache-dir -U pip setuptools wheel && \
|
27 |
pip install --no-cache-dir -r requirements.txt
|
28 |
|
|
|
|
|
|
|
|
|
29 |
# Copy application code
|
30 |
COPY . .
|
31 |
|
@@ -37,4 +43,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
37 |
CMD curl -f http://localhost:7860/health || exit 1
|
38 |
|
39 |
# Run the application
|
40 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
ENV PYTHONUNBUFFERED=1
|
4 |
+
# Replace TRANSFORMERS_CACHE with HF_HOME
|
5 |
+
ENV HF_HOME=/app/cache
|
6 |
ENV UPLOAD_DIR=/app/uploads
|
7 |
+
ENV NLTK_DATA=/tmp/nltk_data
|
8 |
ENV PORT=7860
|
9 |
|
10 |
# Install system dependencies
|
|
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
# Create directories and set permissions
|
21 |
+
RUN mkdir -p /app/cache /app/uploads /app/static /app/images /tmp/nltk_data && \
|
22 |
+
chmod -R 777 /app /tmp/nltk_data
|
23 |
|
24 |
WORKDIR /app
|
25 |
|
|
|
28 |
RUN pip install --no-cache-dir -U pip setuptools wheel && \
|
29 |
pip install --no-cache-dir -r requirements.txt
|
30 |
|
31 |
+
# Clear cache to avoid conflicts with model names
|
32 |
+
RUN rm -rf /app/cache/* && \
|
33 |
+
chmod -R 777 /app/cache
|
34 |
+
|
35 |
# Copy application code
|
36 |
COPY . .
|
37 |
|
|
|
43 |
CMD curl -f http://localhost:7860/health || exit 1
|
44 |
|
45 |
# Run the application
|
46 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|