Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -1,12 +1,17 @@
1
- FROM python:3.10-slim
 
2
 
3
- WORKDIR /app
 
 
4
 
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
 
 
7
 
8
- COPY . .
 
9
 
10
- EXPOSE 7860
11
-
12
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # استفاده از یک تصویر پایه پایتون
2
+ FROM python:3.9
3
 
4
+ # ایجاد یک کاربر جدید
5
+ RUN useradd -m -u 1000 user
6
+ WORKDIR /home/user/app
7
 
8
+ # کپی فایل‌های مورد نیاز
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+ COPY --chown=user . .
12
 
13
+ # تنظیم متغیرهای محیطی
14
+ ENV HUGGING_FACE_HUB_TOKEN="YOUR_HUGGING_FACE_TOKEN"
15
 
16
+ # دستور اجرای برنامه
17
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]