Commit
·
6fb7326
1
Parent(s):
ccd6e6d
deploy
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
@@ -5,14 +5,14 @@ FROM python:3.9
|
|
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 uvicorn fastapi sentence-transformers
|
13 |
|
14 |
-
# Pre-download the model
|
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
|
@@ -20,8 +20,11 @@ WORKDIR /app
|
|
20 |
# Copy application code
|
21 |
COPY . /app
|
22 |
|
|
|
|
|
|
|
23 |
# Expose port for FastAPI
|
24 |
EXPOSE 7860
|
25 |
|
26 |
-
#
|
27 |
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
5 |
ENV HF_HOME="/app/cache"
|
6 |
ENV TRANSFORMERS_CACHE="/app/cache"
|
7 |
|
8 |
+
# Create the cache directory and set permissions
|
9 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
10 |
|
11 |
# Install required Python packages
|
12 |
RUN pip install --no-cache-dir uvicorn fastapi sentence-transformers
|
13 |
|
14 |
+
# Pre-download the model and set proper permissions
|
15 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/clip-ViT-B-32-multilingual-v1')" && chmod -R 777 /app/cache
|
16 |
|
17 |
# Set working directory
|
18 |
WORKDIR /app
|
|
|
20 |
# Copy application code
|
21 |
COPY . /app
|
22 |
|
23 |
+
# Ensure the app runs with correct permissions
|
24 |
+
RUN chmod -R 777 /app
|
25 |
+
|
26 |
# Expose port for FastAPI
|
27 |
EXPOSE 7860
|
28 |
|
29 |
+
# Start the FastAPI app
|
30 |
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|