Amirhustler commited on
Commit
db655f2
·
verified ·
1 Parent(s): 847599e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -14
Dockerfile CHANGED
@@ -1,30 +1,43 @@
1
  FROM python:3.10-slim
2
 
3
- # --- سیستم‌های لازم
4
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
5
-
6
- # --- محیط‌های نوشتنی (برای کش و کانفیگ)
7
  ENV PYTHONUNBUFFERED=1 \
 
 
 
8
  HF_HOME=/app/.cache/huggingface \
9
  XDG_CACHE_HOME=/app/.cache \
10
  MPLCONFIGDIR=/app/.config/matplotlib \
11
  OPENVINO_TELEMETRY=NO \
12
  OV_TELEMETRY=0 \
 
13
  HOME=/app
14
 
15
- RUN mkdir -p /app/.cache/huggingface /app/.cache /app/.config/matplotlib
 
 
 
16
 
17
- # --- نصب وابستگی‌ها
 
18
  WORKDIR /app
19
- COPY requirements.txt /app/requirements.txt
20
- RUN pip install --no-cache-dir -U pip && \
21
- pip install --no-cache-dir -r requirements.txt
22
 
23
- # --- کد برنامه
24
- COPY app.py /app/app.py
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- # --- پورت uvicorn
27
- EXPOSE 7860
28
 
29
- # --- اجرای سرور
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
 
 
 
 
3
  ENV PYTHONUNBUFFERED=1 \
4
+ PIP_PROGRESS_BAR=on \
5
+ PIP_DEFAULT_TIMEOUT=120 \
6
+ PIP_NO_CACHE_DIR=1 \
7
  HF_HOME=/app/.cache/huggingface \
8
  XDG_CACHE_HOME=/app/.cache \
9
  MPLCONFIGDIR=/app/.config/matplotlib \
10
  OPENVINO_TELEMETRY=NO \
11
  OV_TELEMETRY=0 \
12
+ HF_HUB_ENABLE_TELEMETRY=0 \
13
  HOME=/app
14
 
15
+ # ابزار پایه + گواهی‌ها
16
+ RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ git ca-certificates curl && \
18
+ rm -rf /var/lib/apt/lists/*
19
 
20
+ # مسیرهای نوشتنی
21
+ RUN mkdir -p /app /app/.cache/huggingface /app/.cache /app/.config/matplotlib
22
  WORKDIR /app
 
 
 
23
 
24
+ # نصب مرحله‌ای با لاگ واضح
25
+ COPY requirements.txt ./requirements.txt
26
+ RUN python -V && pip -V
27
+ RUN pip install -r requirements.txt -v && \
28
+ python - <<'PY'
29
+ import importlib, sys
30
+ print(">>> Checking imports ...")
31
+ import openvino, transformers, diffusers, optimum
32
+ m = importlib.import_module("optimum.intel.openvino")
33
+ print("OpenVINO:", openvino.__version__)
34
+ print("Transformers:", transformers.__version__)
35
+ print("Diffusers:", diffusers.__version__)
36
+ print("Optimum-Intel OK; has:", [x for x in dir(m) if x.startswith("OV")][:5], "...")
37
+ PY
38
 
39
+ # کد برنامه
40
+ COPY app.py ./app.py
41
 
42
+ EXPOSE 7860
43
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]