Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -9
Dockerfile
CHANGED
|
@@ -1,21 +1,30 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# Install dependencies
|
| 4 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Set working directory
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
# Copy
|
| 10 |
COPY . /app
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
RUN pip install --no-cache-dir --upgrade pip
|
| 14 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
ENV
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
git \
|
| 6 |
+
curl \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Copy project files
|
| 13 |
COPY . /app
|
| 14 |
|
| 15 |
+
# Create a writable cache directory
|
|
|
|
|
|
|
| 16 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 17 |
|
| 18 |
+
# Set environment variables for cache
|
| 19 |
+
ENV TRANSFORMERS_CACHE=/app/cache \
|
| 20 |
+
HF_HOME=/app/cache \
|
| 21 |
+
SENTENCE_TRANSFORMERS_HOME=/app/cache \
|
| 22 |
+
PORT=7860 \
|
| 23 |
+
PYTHONUNBUFFERED=1
|
| 24 |
|
| 25 |
+
# Install Python dependencies
|
| 26 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 27 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# Start FastAPI with Uvicorn
|
| 30 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|