Hong-2 commited on
Commit
2772e32
·
verified ·
1 Parent(s): d253bcc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -13
Dockerfile CHANGED
@@ -1,14 +1,27 @@
1
- FROM python:3.14-slim
2
- RUN apt-get update && apt-get install -y git build-essential
3
- WORKDIR /app
4
- RUN git clone https://github.com/Alishahryar1/free-claude-code.git .
5
- RUN sed -i 's/requires-python = ">=3.14"/requires-python = ">=3.12"/g' pyproject.toml || true
6
- RUN sed -i '1s/^/from typing import Optional\n/' providers/rate_limit.py || true
7
- RUN sed -i '1s/^/from __future__ import annotations\n/' providers/rate_limit.py || true
8
- RUN sed -i "s/ClassVar\['GlobalRateLimiter' | None\]/ClassVar\[Optional\['GlobalRateLimiter'\]\]/g" providers/rate_limit.py || true
9
- RUN sed -i "s/ClassVar\[GlobalRateLimiter | None\]/ClassVar\[Optional\['GlobalRateLimiter'\]\]/g" providers/rate_limit.py || true
10
- RUN sed -i '1s/^/from __future__ import annotations\n/' config/settings.py || true
11
- RUN pip install uv
12
- RUN uv pip install --system . || pip install --no-cache-dir .
 
 
 
 
 
 
 
 
 
 
 
13
  EXPOSE 7860
14
- CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
+ # Sử dụng môi trường Python 3.10 siêu nhẹ
2
+ FROM python:3.10-slim
3
+
4
+ # Thiết lập biến môi trường
5
+ ENV PYTHONUNBUFFERED=1 \
6
+ PYTHONDONTWRITEBYTECODE=1 \
7
+ HOME=/home/user
8
+
9
+ # Ô BẢN CỦA HUGGING FACE: Phải tạo user có quyền UID 1000
10
+ RUN useradd -m -u 1000 user
11
+ USER user
12
+ ENV PATH="/home/user/.local/bin:$PATH"
13
+
14
+ # Chuyển vào thư mục làm việc
15
+ WORKDIR $HOME/app
16
+
17
+ # Cài đặt các thư viện cần thiết (FastAPI, Uvicorn, và SDK Gemini mới nhất)
18
+ RUN pip install --no-cache-dir fastapi uvicorn pydantic google-genai Pillow
19
+
20
+ # Copy toàn bộ file code vào thư mục làm việc
21
+ COPY --chown=user . $HOME/app
22
+
23
+ # Hugging Face yêu cầu mở cổng 7860
24
  EXPOSE 7860
25
+
26
+ # Lệnh khởi chạy server FastAPI
27
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]