Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +23 -10
Dockerfile
CHANGED
@@ -1,21 +1,34 @@
|
|
1 |
-
# ✅
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# ✅
|
5 |
RUN apt-get update && apt-get install -y gcc g++ make
|
6 |
|
7 |
-
# ✅
|
8 |
-
RUN adduser --uid 1000 --disabled-password --gecos '' appuser
|
9 |
-
|
10 |
-
# ✅ Çalışma dizini
|
11 |
WORKDIR /app
|
|
|
12 |
|
13 |
-
# ✅
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
# ✅
|
17 |
COPY requirements.txt ./
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
# ✅
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
1 |
+
# ✅ Base image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# ✅ Install system dependencies
|
5 |
RUN apt-get update && apt-get install -y gcc g++ make
|
6 |
|
7 |
+
# ✅ Create working directory with write permissions (Hugging Face specific)
|
|
|
|
|
|
|
8 |
WORKDIR /app
|
9 |
+
RUN mkdir -p /app/.cache /tmp/.triton /tmp/torchinductor_cache && chmod -R 777 /app/.cache /tmp/.triton /tmp/torchinductor_cache
|
10 |
|
11 |
+
# ✅ Environment variables for Hugging Face caching
|
12 |
+
ENV HF_HOME=/app/.cache \
|
13 |
+
HF_DATASETS_CACHE=/app/.cache \
|
14 |
+
HF_HUB_CACHE=/app/.cache \
|
15 |
+
TRITON_CACHE_DIR=/tmp/.triton \
|
16 |
+
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_cache
|
17 |
|
18 |
+
# ✅ Copy requirements and install
|
19 |
COPY requirements.txt ./
|
20 |
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
22 |
+
# ✅ Copy all project files
|
23 |
+
COPY . .
|
24 |
+
|
25 |
+
# ✅ Expose FastAPI port
|
26 |
+
EXPOSE 7860
|
27 |
+
|
28 |
+
# ✅ Health check dummy server (important for Hugging Face Spaces)
|
29 |
+
# This will run as a background thread inside Python, not as a separate Docker CMD
|
30 |
+
# so we only run uvicorn in CMD below.
|
31 |
+
|
32 |
+
# ✅ Final startup command
|
33 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
34 |
+
|