KrishnaCosmic commited on
Commit
07355a1
·
1 Parent(s): 161a02e

Force rebuild: clear HF cache

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -21
Dockerfile CHANGED
@@ -1,33 +1,50 @@
1
- # Use Python 3.10 as base
2
- FROM python:3.10
 
3
 
4
- # 1. Install Java 21 (Updated from 17)
5
- # The logs specifically asked for openjdk-21-jdk-headless
6
- RUN apt-get update && \
7
- apt-get install -y openjdk-21-jdk-headless && \
8
- apt-get clean;
9
 
10
- # 2. Set JAVA_HOME to the new version
11
- ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
12
-
13
- # Create a non-root user (Required by Hugging Face)
14
  RUN useradd -m -u 1000 user
15
- USER user
16
- ENV PATH="/home/user/.local/bin:$PATH"
17
 
18
  # Set working directory
19
  WORKDIR /app
20
 
21
- # Copy requirements and install
22
- COPY --chown=user ./requirements.txt requirements.txt
23
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- # Copy the rest of the app
26
- COPY --chown=user . /app
27
 
28
- # Expose the correct port
 
 
 
 
 
29
  ENV PORT=7860
 
 
 
 
30
  EXPOSE 7860
31
 
32
- # Start the application
33
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
1
+ # OpenTriage AI Engine - Full Backend
2
+ # Hugging Face Spaces Deployment
3
+ # Cache bust: 2026-01-16-v2 - Force rebuild
4
 
5
+ FROM python:3.10-slim
 
 
 
 
6
 
7
+ # Create non-root user (Hugging Face requirement)
 
 
 
8
  RUN useradd -m -u 1000 user
 
 
9
 
10
  # Set working directory
11
  WORKDIR /app
12
 
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ gcc \
16
+ g++ \
17
+ libffi-dev \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Copy requirements first for better caching
21
+ COPY --chown=user:user requirements.txt .
22
+
23
+ # Install Python dependencies
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy application code
27
+ COPY --chown=user:user . .
28
 
29
+ # Set permissions for user (needed for vector DB caches, etc.)
30
+ RUN chown -R user:user /app
31
 
32
+ # Switch to non-root user
33
+ USER user
34
+
35
+ # Set environment variables
36
+ ENV PYTHONDONTWRITEBYTECODE=1
37
+ ENV PYTHONUNBUFFERED=1
38
  ENV PORT=7860
39
+ ENV HOME=/home/user
40
+ ENV PATH="/home/user/.local/bin:$PATH"
41
+
42
+ # Expose port (Hugging Face Spaces uses 7860)
43
  EXPOSE 7860
44
 
45
+ # Health check
46
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
47
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
48
+
49
+ # Run the application
50
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]