khushiii02 commited on
Commit
bcdc8b7
·
verified ·
1 Parent(s): 7aa8f07

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -23
Dockerfile CHANGED
@@ -2,45 +2,35 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies including uv
6
- RUN apt-get update && apt-get install -y \
7
- build-essential \
8
- curl \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Install uv (required for openenv validate / uv run server)
12
- RUN curl -LsSf https://astral.sh/uv/install.sh | sh 2>/dev/null || \
13
- pip install uv --no-cache-dir
14
 
15
- ENV PATH="/root/.local/bin:${PATH}"
16
-
17
- # Copy project files
18
- COPY pyproject.toml uv.lock ./
19
- COPY requirements.txt ./
20
-
21
- # Install dependencies via pip (reliable fallback over uv in Docker)
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # Install openenv-core (required by validator)
25
- RUN pip install --no-cache-dir "openenv-core>=0.2.0" || \
26
- pip install --no-cache-dir "openenv>=0.2.0" || true
 
27
 
28
- # Copy all source files
29
  COPY . .
30
 
31
- # Mandatory env vars (hackathon spec)
32
  ENV API_BASE_URL="https://router.huggingface.co/v1"
33
  ENV MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
34
  ENV HF_TOKEN=""
35
  ENV HF_HOME=/app/.cache/huggingface
36
  RUN mkdir -p /app/.cache/huggingface
37
 
38
- # HuggingFace Spaces requires port 7860
39
  EXPOSE 7860
40
 
41
- # Health check
42
- HEALTHCHECK --interval=30s --timeout=15s --start-period=120s \
43
  CMD curl -f http://localhost:7860/health || exit 1
44
 
45
- # Start the server — uvicorn directly (works whether or not uv is available)
46
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
2
 
3
  WORKDIR /app
4
 
5
+ RUN apt-get update && apt-get install -y --no-install-recommends curl \
 
 
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Install uv (small, fast binary needed for `uv run server`)
9
+ RUN pip install uv --no-cache-dir --quiet
 
10
 
11
+ # Install main application deps
12
+ COPY requirements.txt .
 
 
 
 
 
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Install openenv-core WITHOUT its heavy deps (gradio etc.)
16
+ # openenv validate checks pyproject.toml, not whether gradio is installed
17
+ RUN pip install --no-cache-dir --no-deps "openenv-core==0.2.3" || \
18
+ pip install --no-cache-dir --no-deps "openenv-core" || true
19
 
20
+ # Copy all project files
21
  COPY . .
22
 
23
+ # Required env vars per hackathon spec
24
  ENV API_BASE_URL="https://router.huggingface.co/v1"
25
  ENV MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
26
  ENV HF_TOKEN=""
27
  ENV HF_HOME=/app/.cache/huggingface
28
  RUN mkdir -p /app/.cache/huggingface
29
 
 
30
  EXPOSE 7860
31
 
32
+ # Short start-period — use_fallback_only=True means env loads in <2s
33
+ HEALTHCHECK --interval=15s --timeout=10s --start-period=30s \
34
  CMD curl -f http://localhost:7860/health || exit 1
35
 
 
36
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]