Spaces:
Sleeping
Sleeping
dockerfile
Browse files- Dockerfile +6 -9
Dockerfile
CHANGED
|
@@ -1,26 +1,23 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
# Copy
|
| 7 |
-
COPY requirements.txt ./
|
| 8 |
|
| 9 |
-
#
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
-
# Hugging Face cache
|
| 13 |
ENV HF_HOME=/app/.cache
|
| 14 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 15 |
|
| 16 |
-
# Pre-download model
|
| 17 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
|
| 18 |
|
| 19 |
-
# Copy rest of the project
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
-
# Expose
|
| 23 |
EXPOSE 8080
|
| 24 |
|
| 25 |
-
# Run app
|
| 26 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Copy requirements + setup.py
|
| 6 |
+
COPY requirements.txt setup.py ./
|
| 7 |
|
| 8 |
+
# dependencies
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
+
# Hugging Face cache
|
| 12 |
ENV HF_HOME=/app/.cache
|
| 13 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 14 |
|
| 15 |
+
# Pre-download model
|
| 16 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
|
| 17 |
|
|
|
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
+
# Expose port Hugging Face
|
| 21 |
EXPOSE 8080
|
| 22 |
|
|
|
|
| 23 |
CMD ["python", "app.py"]
|