Update Dockerfile
Browse files- Dockerfile +0 -9
Dockerfile
CHANGED
@@ -1,13 +1,11 @@
|
|
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
|
11 |
RUN apt-get update && \
|
12 |
apt-get install -y --no-install-recommends \
|
13 |
gcc \
|
@@ -17,30 +15,23 @@ RUN apt-get update && \
|
|
17 |
poppler-utils \
|
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 |
|
26 |
-
# Copy and install requirements
|
27 |
COPY requirements.txt .
|
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 |
|
38 |
-
# Expose port
|
39 |
EXPOSE 7860
|
40 |
|
41 |
-
# Healthcheck
|
42 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
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"]
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
ENV PYTHONUNBUFFERED=1
|
|
|
4 |
ENV HF_HOME=/app/cache
|
5 |
ENV UPLOAD_DIR=/app/uploads
|
6 |
ENV NLTK_DATA=/tmp/nltk_data
|
7 |
ENV PORT=7860
|
8 |
|
|
|
9 |
RUN apt-get update && \
|
10 |
apt-get install -y --no-install-recommends \
|
11 |
gcc \
|
|
|
15 |
poppler-utils \
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
|
|
18 |
RUN mkdir -p /app/cache /app/uploads /app/static /app/images /tmp/nltk_data && \
|
19 |
chmod -R 777 /app /tmp/nltk_data
|
20 |
|
21 |
WORKDIR /app
|
22 |
|
|
|
23 |
COPY requirements.txt .
|
24 |
RUN pip install --no-cache-dir -U pip setuptools wheel && \
|
25 |
pip install --no-cache-dir -r requirements.txt
|
26 |
|
|
|
27 |
RUN rm -rf /app/cache/* && \
|
28 |
chmod -R 777 /app/cache
|
29 |
|
|
|
30 |
COPY . .
|
31 |
|
|
|
32 |
EXPOSE 7860
|
33 |
|
|
|
34 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
35 |
CMD curl -f http://localhost:7860/health || exit 1
|
36 |
|
|
|
37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|