Joe6636564 commited on
Commit
dd5e9be
·
verified ·
1 Parent(s): e6fc608

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -5
Dockerfile CHANGED
@@ -1,14 +1,33 @@
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
 
 
5
  COPY requirements.txt .
6
- RUN apt-get update && apt-get install -y git && \
7
- pip install --no-cache-dir -r requirements.txt
8
 
9
- COPY main.py .
 
 
 
 
10
 
 
 
 
 
11
  EXPOSE 7860
12
- EXPOSE 8000
13
 
14
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
1
  FROM python:3.10-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
+ git \
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
+ # Create cache directory for models
23
+ RUN mkdir -p /root/.cache/huggingface/hub
24
+
25
+ # Expose port
26
  EXPOSE 7860
 
27
 
28
+ # Health check
29
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
30
+ CMD curl -f http://localhost:7860/health || exit 1
31
+
32
+ # Run the application
33
+ CMD ["python", "-u", "app.py"]