Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -10
Dockerfile
CHANGED
|
@@ -20,25 +20,25 @@ RUN apt-get update && apt-get install -y \
|
|
| 20 |
graphviz \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
RUN useradd --create-home --shell /bin/bash
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
# Set working directory inside container
|
| 30 |
WORKDIR /app
|
| 31 |
|
| 32 |
-
# Copy source and requirements (ownership already belongs to
|
| 33 |
-
COPY --chown=
|
| 34 |
-
COPY --chown=
|
| 35 |
|
| 36 |
# Install Python dependencies
|
| 37 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 38 |
|
| 39 |
-
# Update PATH to include user base binary directory
|
| 40 |
-
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
| 41 |
-
|
| 42 |
# Expose port
|
| 43 |
EXPOSE 8501
|
| 44 |
|
|
|
|
| 20 |
graphviz \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
+
# switch to a user that works for spaces
|
| 24 |
+
# RUN useradd --create-home --uid 1000 --shell /bin/bash user
|
| 25 |
+
RUN useradd -m -u 1000 -s /bin/bash user
|
| 26 |
+
USER user
|
| 27 |
|
| 28 |
+
# Update PATH to include user base binary directory
|
| 29 |
+
ENV HOME=/home/user \
|
| 30 |
+
PATH="/home/user/.local/bin:${PATH}"
|
| 31 |
|
| 32 |
# Set working directory inside container
|
| 33 |
WORKDIR /app
|
| 34 |
|
| 35 |
+
# Copy source and requirements (ownership already belongs to user)
|
| 36 |
+
COPY --chown=user:user requirements.txt ./
|
| 37 |
+
COPY --chown=1000 src/ ./src/
|
| 38 |
|
| 39 |
# Install Python dependencies
|
| 40 |
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 41 |
|
|
|
|
|
|
|
|
|
|
| 42 |
# Expose port
|
| 43 |
EXPOSE 8501
|
| 44 |
|