yukee1992 commited on
Commit
813225f
·
verified ·
1 Parent(s): e725178

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -2
Dockerfile CHANGED
@@ -1,13 +1,29 @@
1
  # Dockerfile
2
- FROM python:3.9
3
 
4
  WORKDIR /app
 
 
 
 
 
 
 
 
 
5
  COPY requirements.txt .
6
- RUN pip install -r requirements.txt
7
 
 
 
 
 
8
  COPY . .
9
 
10
  # Expose both ports
11
  EXPOSE 8000 7860
12
 
 
 
 
 
13
  CMD ["python", "app.py"]
 
1
  # Dockerfile
2
+ FROM python:3.9-slim
3
 
4
  WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ git \
9
+ gcc \
10
+ g++ \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements first for better caching
14
  COPY requirements.txt .
 
15
 
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy application code
20
  COPY . .
21
 
22
  # Expose both ports
23
  EXPOSE 8000 7860
24
 
25
+ # Health check
26
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
27
+ CMD curl -f http://localhost:8000/api/health || exit 1
28
+
29
  CMD ["python", "app.py"]