Spaces:
Sleeping
Sleeping
Commit ·
e48a883
1
Parent(s): bb99b47
Uploaded
Browse files- Dockerfile +12 -9
Dockerfile
CHANGED
|
@@ -5,8 +5,6 @@ WORKDIR /app
|
|
| 5 |
|
| 6 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 7 |
ENV TZ=Etc/UTC
|
| 8 |
-
ENV HOME=/tmp/hf-user
|
| 9 |
-
ENV PYTHONUSERBASE=/tmp/hf-user/.local
|
| 10 |
|
| 11 |
# Install Chrome and dependencies for HuggingFace Spaces
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -29,19 +27,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 29 |
procps \
|
| 30 |
&& rm -rf /var/lib/apt/lists/*
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
chmod 755 /tmp/hf-user /tmp/hf-user/.local
|
| 35 |
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 42 |
|
|
|
|
| 43 |
COPY --chown=1000:1000 . .
|
| 44 |
|
|
|
|
| 45 |
RUN mkdir -p config
|
| 46 |
|
| 47 |
EXPOSE 7860
|
|
|
|
| 5 |
|
| 6 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 7 |
ENV TZ=Etc/UTC
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Install Chrome and dependencies for HuggingFace Spaces
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 27 |
procps \
|
| 28 |
&& rm -rf /var/lib/apt/lists/*
|
| 29 |
|
| 30 |
+
# Copy requirements first
|
| 31 |
+
COPY requirements.txt .
|
|
|
|
| 32 |
|
| 33 |
+
# Install Python packages as root BEFORE switching users
|
| 34 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 35 |
|
| 36 |
+
# Now switch to non-root user for HuggingFace Spaces
|
| 37 |
+
USER 1000
|
| 38 |
|
| 39 |
+
# Set environment for user 1000
|
| 40 |
+
ENV HOME=/tmp/hf-user
|
| 41 |
+
ENV PYTHONUSERBASE=/tmp/hf-user/.local
|
| 42 |
+
ENV PATH="/tmp/hf-user/.local/bin:$PATH"
|
| 43 |
|
| 44 |
+
# Copy application files
|
| 45 |
COPY --chown=1000:1000 . .
|
| 46 |
|
| 47 |
+
# Create config directory
|
| 48 |
RUN mkdir -p config
|
| 49 |
|
| 50 |
EXPOSE 7860
|