Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +11 -19
Dockerfile
CHANGED
|
@@ -2,7 +2,8 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
-
DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 6 |
|
| 7 |
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -11,38 +12,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 11 |
libxext6 \
|
| 12 |
libxrender-dev \
|
| 13 |
libgomp1 \
|
| 14 |
-
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
# Create
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
-
# Create user
|
| 21 |
-
RUN useradd -m -u 1000 user &&
|
| 22 |
-
chown -R user:user /app
|
| 23 |
-
|
| 24 |
-
# Switch to user
|
| 25 |
USER user
|
| 26 |
-
|
| 27 |
-
# Set PATH
|
| 28 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 29 |
|
| 30 |
-
# Copy and install
|
| 31 |
-
COPY --chown=user:user requirements.txt /app/
|
| 32 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 33 |
|
| 34 |
-
# Copy application
|
| 35 |
-
COPY --chown=user:user . /app
|
| 36 |
|
| 37 |
# Create necessary directories
|
| 38 |
RUN mkdir -p /app/captured_images /app/temp_audio
|
| 39 |
|
| 40 |
-
# Expose Hugging Face
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
-
# Health check
|
| 44 |
-
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
| 45 |
-
CMD python -c "import requests; requests.get('http://localhost:7860')"
|
| 46 |
-
|
| 47 |
# Run application
|
| 48 |
CMD ["python", "app.py"]
|
|
|
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
+
DEBIAN_FRONTEND=noninteractive \
|
| 6 |
+
TF_ENABLE_ONEDNN_OPTS=0
|
| 7 |
|
| 8 |
# Install system dependencies
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 12 |
libxext6 \
|
| 13 |
libxrender-dev \
|
| 14 |
libgomp1 \
|
| 15 |
+
&& apt-get clean \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
+
# Create working directory
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
+
# Create user for Hugging Face
|
| 22 |
+
RUN useradd -m -u 1000 user && chown -R user:user /app
|
|
|
|
|
|
|
|
|
|
| 23 |
USER user
|
|
|
|
|
|
|
| 24 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 25 |
|
| 26 |
+
# Copy and install Python dependencies
|
| 27 |
+
COPY --chown=user:user requirements.txt /app/
|
| 28 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 29 |
|
| 30 |
+
# Copy application code
|
| 31 |
+
COPY --chown=user:user . /app/
|
| 32 |
|
| 33 |
# Create necessary directories
|
| 34 |
RUN mkdir -p /app/captured_images /app/temp_audio
|
| 35 |
|
| 36 |
+
# Expose Hugging Face port
|
| 37 |
EXPOSE 7860
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# Run application
|
| 40 |
CMD ["python", "app.py"]
|