viskav commited on
Commit
d8fc11d
·
verified ·
1 Parent(s): 105b25f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -18
Dockerfile CHANGED
@@ -1,32 +1,32 @@
1
  FROM python:3.10-slim
2
 
3
- # Avoid Python buffering issues
4
- ENV PYTHONUNBUFFERED=1
5
- ENV HF_HUB_ENABLE_HF_TRANSFER=1
6
 
7
- # System dependencies for llama.cpp
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  cmake \
11
- git \
12
- curl \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Set working directory
16
- WORKDIR /code
17
-
18
- # Copy requirements first (better caching)
19
- COPY requirements.txt /code/
20
 
21
  # Install Python dependencies
22
- RUN pip install --no-cache-dir --upgrade pip \
23
- && pip install --no-cache-dir -r requirements.txt
24
 
25
- # Copy app code
26
- COPY app.py /code/app.py
27
 
28
- # Expose HF default port
29
  EXPOSE 7860
30
 
31
- # IMPORTANT: Start FastAPI server
32
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ WORKDIR /app
 
 
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  cmake \
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy requirements
12
+ COPY requirements.txt .
 
 
 
13
 
14
  # Install Python dependencies
15
+ RUN pip install --no-cache-dir -r requirements.txt
 
16
 
17
+ # Copy application
18
+ COPY app.py .
19
 
20
+ # Expose port
21
  EXPOSE 7860
22
 
23
+ # Set environment variables
24
+ ENV PORT=7860
25
+ ENV HF_HOME=/app/models
26
+
27
+ # Health check
28
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=300s --retries=3 \
29
+ CMD python -c "import requests; requests.get('http://localhost:7860/health')"
30
+
31
+ # Run the application
32
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]