Spaces:
Running
Running
File size: 1,056 Bytes
565afe0 63e7b53 916f2c9 63e7b53 916f2c9 565afe0 63e7b53 916f2c9 bb99b47 ba9916c 565afe0 ba9916c 565afe0 1d8ff49 bb99b47 36fd3e9 63e7b53 916f2c9 565afe0 e48a883 565afe0 e48a883 47135f7 565afe0 e48a883 916f2c9 565afe0 bb99b47 565afe0 36fd3e9 63e7b53 916f2c9 565afe0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# Dockerfile
FROM python:3.11-slim
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
# Install Chrome and dependencies for HuggingFace Spaces
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium \
chromium-driver \
ca-certificates \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libdrm2 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libxss1 \
libxtst6 \
libgbm1 \
libxrandr2 \
libxcomposite1 \
libxdamage1 \
procps \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first
COPY requirements.txt .
# Install Python packages as root BEFORE switching users
RUN pip install --no-cache-dir -r requirements.txt
# Now switch to non-root user for HuggingFace Spaces
USER 1000
# Set environment for user 1000
ENV HOME=/tmp/hf-user
ENV PYTHONUSERBASE=/tmp/hf-user/.local
ENV PATH="/tmp/hf-user/.local/bin:$PATH"
# Copy application files
COPY --chown=1000:1000 . .
# Create config directory
RUN mkdir -p config
EXPOSE 7860
CMD ["python", "server.py"] |