Omartificial-Intelligence-Space commited on
Commit
cd91348
·
verified ·
1 Parent(s): 7478cb5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -4
Dockerfile CHANGED
@@ -2,15 +2,34 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies (if needed)
6
- RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
 
 
 
7
 
 
8
  COPY requirements.txt .
 
 
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
 
11
  COPY . .
12
 
13
- # Expose the port expected by Hugging Face Spaces
 
 
 
 
 
 
 
14
  EXPOSE 7860
15
 
16
- CMD ["python", "app.py"]
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
8
+ curl \
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 -r requirements.txt
16
 
17
+ # Copy application code
18
  COPY . .
19
 
20
+ # Create uploads directory
21
+ RUN mkdir -p /app/uploads
22
+
23
+ # Set environment variables
24
+ ENV PYTHONUNBUFFERED=1
25
+ ENV FLASK_APP=app.py
26
+
27
+ # Expose the port
28
  EXPOSE 7860
29
 
30
+ # Health check
31
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
32
+ CMD curl -f http://localhost:7860/health || exit 1
33
+
34
+ # Run the application
35
+ CMD ["python", "app.py"]