Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -12
Dockerfile
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
# Base image with Python
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Install
|
5 |
-
RUN apt-get update && apt-get install -y
|
6 |
-
git \
|
7 |
-
curl \
|
8 |
-
&& rm -rf /var/lib/apt/lists/*
|
9 |
|
10 |
-
# Set
|
11 |
WORKDIR /app
|
12 |
|
13 |
-
#
|
|
|
|
|
|
|
|
|
14 |
COPY . /app
|
15 |
|
16 |
-
# Install Python
|
17 |
RUN pip install --no-cache-dir --upgrade pip
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
#
|
21 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
22 |
|
23 |
-
# Expose
|
24 |
ENV PORT 7860
|
25 |
|
26 |
-
#
|
27 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
# Install dependencies
|
4 |
+
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
5 |
|
6 |
+
# Set working directory
|
7 |
WORKDIR /app
|
8 |
|
9 |
+
# Create a local cache dir for HuggingFace models
|
10 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
11 |
+
ENV HF_HOME=/app/.cache/huggingface
|
12 |
+
|
13 |
+
# Copy source files
|
14 |
COPY . /app
|
15 |
|
16 |
+
# Install Python packages
|
17 |
RUN pip install --no-cache-dir --upgrade pip
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
+
# Preload model into cache
|
21 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
22 |
|
23 |
+
# Expose port for Hugging Face Spaces
|
24 |
ENV PORT 7860
|
25 |
|
26 |
+
# Launch FastAPI with Uvicorn
|
27 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|