Spaces:
Sleeping
Sleeping
Commit
·
97a7505
1
Parent(s):
e1bfb0a
Intial Config
Browse files- Dockerfile +22 -6
Dockerfile
CHANGED
|
@@ -1,16 +1,32 @@
|
|
| 1 |
-
# Read the
|
| 2 |
-
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
USER user
|
| 8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Read the guide: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
FROM python:3.10.0-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies for PyAudio (PortAudio) and general build tools
|
| 5 |
+
USER root
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get install -y --no-install-recommends \
|
| 8 |
+
build-essential \
|
| 9 |
+
portaudio19-dev \
|
| 10 |
+
libsndfile1 && \
|
| 11 |
+
rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Create a non-root user (per HF Spaces best practices)
|
| 14 |
RUN useradd -m -u 1000 user
|
| 15 |
USER user
|
| 16 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
+
# Copy and install Python requirements
|
| 21 |
+
COPY --chown=user requirements.txt .
|
| 22 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 23 |
+
pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
+
# Copy application code
|
| 26 |
+
COPY --chown=user . .
|
| 27 |
+
|
| 28 |
+
# Expose the Gradio/Uvicorn port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Launch the FastAPI + Gradio server
|
| 32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|