Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +3 -25
Dockerfile
CHANGED
|
@@ -1,33 +1,11 @@
|
|
| 1 |
-
# Use lightweight Python base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
-
|
| 4 |
-
# Disable CUDA & set cache locations
|
| 5 |
ENV TORCH_DISABLE_CUDA=1
|
| 6 |
-
ENV TRANSFORMERS_CACHE=/app/hf_cache
|
| 7 |
ENV HF_HOME=/app/hf_cache
|
| 8 |
-
|
| 9 |
-
# Working directory
|
| 10 |
WORKDIR /app
|
| 11 |
-
|
| 12 |
-
# Copy dependency list
|
| 13 |
COPY requirements.txt .
|
| 14 |
-
|
| 15 |
-
# Install dependencies efficiently
|
| 16 |
-
RUN apt-get update && apt-get install -y git && \
|
| 17 |
-
pip install --no-cache-dir -r requirements.txt && \
|
| 18 |
-
rm -rf /var/lib/apt/lists/*
|
| 19 |
-
|
| 20 |
-
# Copy app code
|
| 21 |
COPY . .
|
| 22 |
-
|
| 23 |
-
# Create cache folder (writable)
|
| 24 |
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
| 25 |
-
|
| 26 |
-
# Expose port for FastAPI
|
| 27 |
EXPOSE 8080
|
| 28 |
-
|
| 29 |
-
# Health check (optional for Cloud Run / Spaces)
|
| 30 |
-
HEALTHCHECK CMD curl --fail http://localhost:8080/ || exit 1
|
| 31 |
-
|
| 32 |
-
CMD ["python", "main.py"]
|
| 33 |
-
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
|
|
|
|
|
|
| 2 |
ENV TORCH_DISABLE_CUDA=1
|
|
|
|
| 3 |
ENV HF_HOME=/app/hf_cache
|
| 4 |
+
ENV TRANSFORMERS_CACHE=/app/hf_cache
|
|
|
|
| 5 |
WORKDIR /app
|
|
|
|
|
|
|
| 6 |
COPY requirements.txt .
|
| 7 |
+
RUN apt-get update && apt-get install -y git && pip install --no-cache-dir -r requirements.txt && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY . .
|
|
|
|
|
|
|
| 9 |
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
|
|
|
|
|
|
| 10 |
EXPOSE 8080
|
| 11 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|