Update Dockerfile
Browse files- Dockerfile +11 -13
Dockerfile
CHANGED
|
@@ -1,26 +1,24 @@
|
|
| 1 |
-
# Use Python 3.9 slim for a smaller footprint
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Install system dependencies for audio processing (ffmpeg) and build tools
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
ffmpeg \
|
| 10 |
build-essential \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
RUN pip install --no-cache-dir -
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
COPY . .
|
| 21 |
|
| 22 |
-
# Hugging Face Spaces listen on port 7860 by default
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
# Run the FastAPI app with Uvicorn
|
| 26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
ffmpeg \
|
| 6 |
build-essential \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# Create a non-root user for HF Spaces
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
+
USER user
|
| 12 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
| 13 |
+
|
| 14 |
+
WORKDIR /app
|
| 15 |
|
| 16 |
+
COPY --chown=user requirements.txt .
|
| 17 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 18 |
+
pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
COPY --chown=user . .
|
|
|
|
| 21 |
|
|
|
|
| 22 |
EXPOSE 7860
|
| 23 |
|
|
|
|
| 24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|