Spaces:
Sleeping
Sleeping
Commit ·
1f25e74
1
Parent(s): 5516b13
Configure Dockerfile for Hugging Face Spaces
Browse files- Dockerfile +14 -13
Dockerfile
CHANGED
|
@@ -1,28 +1,29 @@
|
|
| 1 |
# Use official Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
ffmpeg \
|
| 7 |
libsndfile1 \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
COPY requirements.txt .
|
| 15 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
-
# Copy
|
| 18 |
-
COPY .
|
|
|
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
|
| 23 |
-
# Set
|
| 24 |
-
# HF Spaces uses port 7860 by default
|
| 25 |
ENV PORT=7860
|
|
|
|
| 26 |
|
| 27 |
-
# Command to run
|
| 28 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Use official Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
ffmpeg \
|
| 7 |
libsndfile1 \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Setup user for Hugging Face (Required ID 1000)
|
| 11 |
+
RUN useradd -m -u 1000 user
|
| 12 |
+
USER user
|
| 13 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 14 |
|
| 15 |
+
WORKDIR /app
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Copy and install requirements
|
| 18 |
+
COPY --chown=user requirements.txt .
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
+
# Copy application code
|
| 22 |
+
COPY --chown=user ./app ./app
|
| 23 |
|
| 24 |
+
# Set port
|
|
|
|
| 25 |
ENV PORT=7860
|
| 26 |
+
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Command to run API
|
| 29 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|