Joe6636564 commited on
Commit
31009e8
·
verified ·
1 Parent(s): a8610de

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -4
Dockerfile CHANGED
@@ -1,13 +1,39 @@
1
- FROM python:3.10
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
 
7
- RUN pip install --no-cache-dir -r requirements.txt
 
8
 
 
9
  COPY . .
10
 
11
- EXPOSE 7860
 
 
 
 
 
 
 
 
12
 
13
- CMD ["python", "app.py"]
 
 
1
+ FROM nvidia/cuda:12.1-runtime-ubuntu22.04
2
 
3
+ # Set environment variables
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV HF_HOME=/app/cache
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y \
10
+ python3 \
11
+ python3-pip \
12
+ python3-venv \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Set working directory
17
  WORKDIR /app
18
 
19
+ # Copy requirements and install Python dependencies
20
  COPY requirements.txt .
21
 
22
+ # Install Python dependencies
23
+ RUN pip3 install --no-cache-dir -r requirements.txt
24
 
25
+ # Copy application code
26
  COPY . .
27
 
28
+ # Create cache directory
29
+ RUN mkdir -p /app/cache
30
+
31
+ # Expose ports
32
+ EXPOSE 7860 5000
33
+
34
+ # Health check
35
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
36
+ CMD curl -f http://localhost:5000/health || exit 1
37
 
38
+ # Run both Gradio and Flask servers
39
+ CMD ["python3", "app.py"]