mike23415 commited on
Commit
c28a4eb
·
verified ·
1 Parent(s): b95f309

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -3
Dockerfile CHANGED
@@ -1,9 +1,34 @@
1
- FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
- COPY . /app
5
 
 
 
 
 
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
 
 
 
 
 
 
 
 
 
 
8
  EXPOSE 7860
9
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
 
3
+ # Set working directory
4
  WORKDIR /app
 
5
 
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ gcc \
9
+ g++ \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements and install Python dependencies
13
+ COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Copy application code
17
+ COPY app.py .
18
+
19
+ # Create temporary directories
20
+ RUN mkdir -p /tmp/uploads /tmp/processed
21
+
22
+ # Create non-root user
23
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app /tmp
24
+ USER appuser
25
+
26
+ # Expose port
27
  EXPOSE 7860
28
+
29
+ # Health check
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
31
+ CMD curl -f http://localhost:7860/api/health || exit 1
32
+
33
+ # Start application
34
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]