Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -9
Dockerfile
CHANGED
|
@@ -2,36 +2,42 @@
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# 1. Install System Dependencies
|
| 5 |
-
#
|
| 6 |
-
#
|
| 7 |
-
# libasound2
|
|
|
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
libgl1 \
|
| 10 |
libglib2.0-0 \
|
| 11 |
libasound2 \
|
| 12 |
libasound2-plugins \
|
| 13 |
libssl-dev \
|
|
|
|
| 14 |
ffmpeg \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
# 2.
|
|
|
|
|
|
|
|
|
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
-
#
|
| 21 |
COPY requirements.txt .
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
-
#
|
| 25 |
COPY app.py .
|
| 26 |
|
| 27 |
-
#
|
| 28 |
RUN useradd -m -u 1000 user
|
| 29 |
USER user
|
| 30 |
ENV HOME=/home/user \
|
| 31 |
PATH=/home/user/.local/bin:$PATH
|
| 32 |
|
| 33 |
-
#
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
-
#
|
| 37 |
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# 1. Install System Dependencies
|
| 5 |
+
# ca-certificates: REQUIRED for Azure to connect via HTTPS (Fixes Error 2176)
|
| 6 |
+
# libssl-dev: Required for Azure Authentication
|
| 7 |
+
# libasound2: Required for Audio processing
|
| 8 |
+
# ffmpeg: Required for audio sanitization
|
| 9 |
+
# libgl1: Required for OpenCV
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
libgl1 \
|
| 12 |
libglib2.0-0 \
|
| 13 |
libasound2 \
|
| 14 |
libasound2-plugins \
|
| 15 |
libssl-dev \
|
| 16 |
+
ca-certificates \
|
| 17 |
ffmpeg \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
+
# 2. Refresh SSL Certificates
|
| 21 |
+
RUN update-ca-certificates
|
| 22 |
+
|
| 23 |
+
# 3. Setup Work Directory
|
| 24 |
WORKDIR /app
|
| 25 |
|
| 26 |
+
# 4. Install Python Dependencies
|
| 27 |
COPY requirements.txt .
|
| 28 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 29 |
|
| 30 |
+
# 5. Copy Server Code
|
| 31 |
COPY app.py .
|
| 32 |
|
| 33 |
+
# 6. Security: Create non-root user (Mandatory for HF Spaces)
|
| 34 |
RUN useradd -m -u 1000 user
|
| 35 |
USER user
|
| 36 |
ENV HOME=/home/user \
|
| 37 |
PATH=/home/user/.local/bin:$PATH
|
| 38 |
|
| 39 |
+
# 7. Expose the specific HF port
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
+
# 8. Start Command
|
| 43 |
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:7860", "app:app"]
|