LovnishVerma commited on
Commit
666e74d
·
verified ·
1 Parent(s): 999e280

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -8
Dockerfile CHANGED
@@ -1,12 +1,37 @@
 
1
  FROM python:3.11-slim
 
 
2
  WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  COPY requirements.txt .
4
- RUN pip install --no-cache-dir -r requirements.txt
5
- COPY . .
6
- RUN chmod +x start.sh
7
- RUN useradd -m -u 1000 user
8
- USER user
9
- ENV HOME=/home/user \
10
- PATH=/home/user/.local/bin:$PATH
 
 
11
  EXPOSE 7860
12
- CMD ["./start.sh"]
 
 
 
 
 
 
 
1
+ # Use Python 3.11 slim image for better compatibility
2
  FROM python:3.11-slim
3
+
4
+ # Set working directory
5
  WORKDIR /app
6
+
7
+ # Set environment variables
8
+ ENV PYTHONUNBUFFERED=1 \
9
+ PYTHONDONTWRITEBYTECODE=1 \
10
+ GRADIO_SERVER_NAME=0.0.0.0 \
11
+ GRADIO_SERVER_PORT=7860
12
+
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y \
15
+ build-essential \
16
+ curl \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Copy requirements file
20
  COPY requirements.txt .
21
+
22
+ # Install Python dependencies
23
+ RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy application files
27
+ COPY app.py .
28
+
29
+ # Expose the port Gradio runs on
30
  EXPOSE 7860
31
+
32
+ # Health check
33
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
34
+ CMD curl -f http://localhost:7860/ || exit 1
35
+
36
+ # Run the application
37
+ CMD ["python", "app.py"]