Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +35 -34
Dockerfile
CHANGED
@@ -1,34 +1,35 @@
|
|
1 |
-
FROM python:3.10-slim
|
2 |
-
|
3 |
-
# Set environment variables for Hugging Face cache
|
4 |
-
|
5 |
-
ENV
|
6 |
-
ENV
|
7 |
-
ENV
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Set environment variables for Hugging Face cache
|
4 |
+
# Before running your app
|
5 |
+
ENV HF_HOME=/app/hf_cache
|
6 |
+
ENV TRANSFORMERS_CACHE=/app/hf_cache
|
7 |
+
ENV XDG_CACHE_HOME=/app/hf_cache
|
8 |
+
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
9 |
+
|
10 |
+
# Create working directory
|
11 |
+
WORKDIR /code
|
12 |
+
|
13 |
+
# System dependencies
|
14 |
+
RUN apt-get update && apt-get install -y \
|
15 |
+
git \
|
16 |
+
wget \
|
17 |
+
build-essential \
|
18 |
+
&& rm -rf /var/lib/apt/lists/*
|
19 |
+
|
20 |
+
# Install Python packages
|
21 |
+
COPY requirements.txt .
|
22 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
23 |
+
&& pip install --no-cache-dir -r requirements.txt
|
24 |
+
|
25 |
+
# Copy app code
|
26 |
+
COPY . .
|
27 |
+
|
28 |
+
# Create model cache directory
|
29 |
+
RUN mkdir -p /code/hf_cache
|
30 |
+
|
31 |
+
# Expose FastAPI port
|
32 |
+
EXPOSE 7860
|
33 |
+
|
34 |
+
# Start the app
|
35 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|