Hadiil commited on
Commit
ca868f2
·
verified ·
1 Parent(s): 226c64f

Update Dockerfile

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