waleeyd commited on
Commit
5cecfde
·
verified ·
1 Parent(s): b0e1c00

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -5
Dockerfile CHANGED
@@ -1,5 +1,6 @@
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies
@@ -7,23 +8,31 @@ RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # Copy requirements
11
  COPY requirements.txt .
12
 
13
  # Install Python dependencies
14
- RUN pip install --no-cache-dir -r requirements.txt
 
15
 
16
  # Copy application files
17
- COPY . .
 
 
18
 
19
  # Create uploads directory
20
  RUN mkdir -p uploads
21
 
22
- # Expose port
23
  EXPOSE 7860
24
 
25
- # Set environment variable
26
  ENV PORT=7860
 
 
 
 
 
27
 
28
  # Run the application
29
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
  # Install system dependencies
 
8
  build-essential \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy requirements first for better caching
12
  COPY requirements.txt .
13
 
14
  # Install Python dependencies
15
+ RUN pip install --no-cache-dir --upgrade pip && \
16
+ pip install --no-cache-dir -r requirements.txt
17
 
18
  # Copy application files
19
+ COPY app.py .
20
+ COPY templates templates/
21
+ COPY static static/
22
 
23
  # Create uploads directory
24
  RUN mkdir -p uploads
25
 
26
+ # Expose the port
27
  EXPOSE 7860
28
 
29
+ # Set environment variables
30
  ENV PORT=7860
31
+ ENV PYTHONUNBUFFERED=1
32
+
33
+ # Health check
34
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
35
+ CMD python -c "import requests; requests.get('http://localhost:7860/health', timeout=5)"
36
 
37
  # Run the application
38
  CMD ["python", "app.py"]