Commit
·
8753236
1
Parent(s):
6d2a4c3
deploy
Browse files- Dockerfile +25 -6
Dockerfile
CHANGED
@@ -1,8 +1,27 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
WORKDIR /app
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
7 |
EXPOSE 7860
|
8 |
-
|
|
|
|
|
|
1 |
+
# Use an official Python image
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Set environment variables for cache location
|
5 |
+
ENV HF_HOME="/app/cache"
|
6 |
+
ENV TRANSFORMERS_CACHE="/app/cache"
|
7 |
+
|
8 |
+
# Create the cache directory
|
9 |
+
RUN mkdir -p /app/cache
|
10 |
+
|
11 |
+
# Install required Python packages
|
12 |
+
RUN pip install --no-cache-dir sentence-transformers
|
13 |
+
|
14 |
+
# Pre-download the model during the image build process
|
15 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/clip-ViT-B-32-multilingual-v1')"
|
16 |
+
|
17 |
+
# Set working directory
|
18 |
WORKDIR /app
|
19 |
+
|
20 |
+
# Copy application code
|
21 |
+
COPY . /app
|
22 |
+
|
23 |
+
# Expose port (if using FastAPI)
|
24 |
EXPOSE 7860
|
25 |
+
|
26 |
+
# Command to run the application
|
27 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|