Redfire-1234 commited on
Commit
e7bc139
·
verified ·
1 Parent(s): 49adc11

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -7
Dockerfile CHANGED
@@ -6,22 +6,29 @@ WORKDIR /app
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  # Copy requirements first (for layer 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 necessary directories
21
- RUN mkdir -p data/vector_store
 
22
 
23
- # Expose port
24
- EXPOSE 8000
25
 
26
- # Run the application
27
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
 
 
 
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
+ curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Copy requirements first (for layer caching)
13
  COPY requirements.txt .
14
 
15
  # Install Python dependencies
16
+ RUN pip install --no-cache-dir --upgrade pip && \
17
+ pip install --no-cache-dir -r requirements.txt
18
 
19
  # Copy application code
20
  COPY . .
21
 
22
+ # Create necessary directories with proper permissions
23
+ RUN mkdir -p data/vector_store && \
24
+ chmod -R 777 data
25
 
26
+ # Expose port 7860 (Hugging Face Spaces requirement)
27
+ EXPOSE 7860
28
 
29
+ # Health check
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
31
+ CMD curl -f http://localhost:7860/ || exit 1
32
+
33
+ # Run the application on port 7860
34
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]