Spaces:
Paused
Paused
Update dockferfile
Browse files- dockferfile +29 -14
dockferfile
CHANGED
@@ -1,21 +1,36 @@
|
|
|
|
1 |
FROM python:3.11-slim
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
-
#
|
10 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
-
&& pip install --no-cache-dir -r requirements.txt
|
18 |
|
19 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
EXPOSE 7860
|
21 |
-
|
|
|
|
|
|
1 |
+
# Use lightweight Python base
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
+
# Set environment variables
|
5 |
+
ENV PYTHONUNBUFFERED=1 \
|
6 |
+
PIP_NO_CACHE_DIR=1 \
|
7 |
+
HF_HOME=/tmp/huggingface \
|
8 |
+
TRANSFORMERS_CACHE=/tmp/huggingface \
|
9 |
+
HF_HUB_CACHE=/tmp/huggingface
|
10 |
|
11 |
+
# Install system deps
|
12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
13 |
+
build-essential \
|
14 |
+
git \
|
15 |
+
curl \
|
16 |
+
cmake \
|
17 |
+
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
+
# Create working directory
|
20 |
+
WORKDIR /app
|
21 |
|
22 |
+
# Copy requirements (create a requirements.txt alongside app.py)
|
23 |
+
COPY requirements.txt .
|
|
|
24 |
|
25 |
+
# Install Python deps
|
26 |
+
RUN pip install --upgrade pip \
|
27 |
+
&& pip install -r requirements.txt
|
28 |
+
|
29 |
+
# Copy the source code
|
30 |
+
COPY . .
|
31 |
+
|
32 |
+
# Expose HF Spaces port
|
33 |
EXPOSE 7860
|
34 |
+
|
35 |
+
# Run FastAPI server
|
36 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|