doniramdani820 commited on
Commit
2e9eae6
·
verified ·
1 Parent(s): a891b12

Upload 7 files

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -7
  2. Dockerfile.fallback +39 -0
  3. requirements.txt +3 -3
Dockerfile CHANGED
@@ -3,17 +3,11 @@
3
 
4
  FROM python:3.11-slim as base
5
 
6
- # Install system dependencies yang diperlukan (minimal) + fix untuk ONNX Runtime
7
  RUN apt-get update && apt-get install -y \
8
  curl \
9
  libglib2.0-0 \
10
- libsm6 \
11
- libxext6 \
12
- libxrender-dev \
13
  libgomp1 \
14
- libglib2.0-0 \
15
- libgl1-mesa-glx \
16
- libgthread-2.0-0 \
17
  && rm -rf /var/lib/apt/lists/* \
18
  && apt-get clean
19
 
 
3
 
4
  FROM python:3.11-slim as base
5
 
6
+ # Install system dependencies (minimal set compatible dengan Debian Trixie)
7
  RUN apt-get update && apt-get install -y \
8
  curl \
9
  libglib2.0-0 \
 
 
 
10
  libgomp1 \
 
 
 
11
  && rm -rf /var/lib/apt/lists/* \
12
  && apt-get clean
13
 
Dockerfile.fallback ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fallback Dockerfile untuk HF Spaces jika main Dockerfile gagal
2
+ # Ultra minimal approach without any optional dependencies
3
+
4
+ FROM python:3.11-slim
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Install hanya curl untuk health check (essential)
10
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements dan install Python dependencies
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir --upgrade pip && \
15
+ pip install --no-cache-dir -r requirements.txt && \
16
+ pip cache purge
17
+
18
+ # Copy aplikasi
19
+ COPY . .
20
+
21
+ # Set environment variables
22
+ ENV PYTHONUNBUFFERED=1
23
+ ENV PYTHONDONTWRITEBYTECODE=1
24
+ ENV OMP_NUM_THREADS=1
25
+ ENV MKL_NUM_THREADS=1
26
+ ENV OPENBLAS_NUM_THREADS=1
27
+ ENV NUMEXPR_NUM_THREADS=1
28
+ ENV ORT_DISABLE_ALL_OPTIMIZATION=1
29
+ ENV ONNXRUNTIME_LOG_SEVERITY_LEVEL=3
30
+
31
+ # Expose port
32
+ EXPOSE 7860
33
+
34
+ # Health check
35
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
36
+ CMD curl -f http://localhost:7860/health || exit 1
37
+
38
+ # Run aplikasi
39
+ CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
requirements.txt CHANGED
@@ -5,11 +5,11 @@
5
  fastapi==0.104.1
6
  uvicorn[standard]==0.24.0
7
 
8
- # ML/AI dependencies - HF Spaces compatible versions (fixed executable stack issue)
9
  onnxruntime==1.15.1
10
- opencv-python-headless==4.8.0.76
11
  numpy==1.24.3
12
- pillow==10.0.1
13
 
14
  # Utility libraries - Minimal yang diperlukan
15
  pyyaml==6.0.1
 
5
  fastapi==0.104.1
6
  uvicorn[standard]==0.24.0
7
 
8
+ # ML/AI dependencies - Ultra compatible versions for HF Spaces
9
  onnxruntime==1.15.1
10
+ opencv-python-headless==4.7.1.72
11
  numpy==1.24.3
12
+ pillow==9.5.0
13
 
14
  # Utility libraries - Minimal yang diperlukan
15
  pyyaml==6.0.1