Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +2 -7
Dockerfile
CHANGED
|
@@ -1,22 +1,17 @@
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
| 3 |
-
# Create user (optional safety layer, not required for HF Spaces)
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
|
| 7 |
-
# Set working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
# Set Hugging Face Transformers cache path
|
| 11 |
ENV TRANSFORMERS_CACHE=/app/hf_cache
|
| 12 |
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
| 13 |
|
| 14 |
-
# Install dependencies
|
| 15 |
COPY --chown=user requirements.txt requirements.txt
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
-
# Copy the app code
|
| 19 |
COPY --chown=user . .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
|
|
|
| 3 |
RUN useradd -m -u 1000 user
|
| 4 |
USER user
|
| 5 |
|
|
|
|
| 6 |
WORKDIR /app
|
| 7 |
|
|
|
|
| 8 |
ENV TRANSFORMERS_CACHE=/app/hf_cache
|
| 9 |
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
|
| 10 |
|
|
|
|
| 11 |
COPY --chown=user requirements.txt requirements.txt
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
|
|
|
| 14 |
COPY --chown=user . .
|
| 15 |
|
| 16 |
+
# ✅ Use python -m uvicorn instead of uvicorn directly
|
| 17 |
+
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|