Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +10 -3
Dockerfile
CHANGED
@@ -5,10 +5,10 @@ FROM python:3.10-slim
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
ENV PYTHONUNBUFFERED=1
|
7 |
|
8 |
-
# Set working directory
|
9 |
WORKDIR /home/streamlit_user/app
|
10 |
|
11 |
-
# Install system dependencies
|
12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
13 |
build-essential \
|
14 |
git \
|
@@ -16,7 +16,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
16 |
libgl1-mesa-glx \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
-
#
|
|
|
|
|
|
|
|
|
20 |
COPY requirements.txt ./requirements.txt
|
21 |
|
22 |
# Install Python dependencies
|
@@ -26,6 +30,9 @@ RUN pip install --upgrade pip && \
|
|
26 |
# Copy the rest of your app files
|
27 |
COPY src/ ./src/
|
28 |
|
|
|
|
|
|
|
29 |
# Expose Streamlit default port
|
30 |
EXPOSE 8501
|
31 |
|
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
ENV PYTHONUNBUFFERED=1
|
7 |
|
8 |
+
# Set working directory to home/streamlit_user (non-root user directory)
|
9 |
WORKDIR /home/streamlit_user/app
|
10 |
|
11 |
+
# Install system dependencies (including for image processing and huggingface)
|
12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
13 |
build-essential \
|
14 |
git \
|
|
|
16 |
libgl1-mesa-glx \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
+
# Create a directory for model weights under the user directory and set permissions
|
20 |
+
RUN mkdir -p /home/streamlit_user/step1x_weights && \
|
21 |
+
chown -R streamlit_user:streamlit_user /home/streamlit_user/step1x_weights
|
22 |
+
|
23 |
+
# Copy requirements.txt first to leverage Docker cache
|
24 |
COPY requirements.txt ./requirements.txt
|
25 |
|
26 |
# Install Python dependencies
|
|
|
30 |
# Copy the rest of your app files
|
31 |
COPY src/ ./src/
|
32 |
|
33 |
+
# Set user for the app
|
34 |
+
USER streamlit_user
|
35 |
+
|
36 |
# Expose Streamlit default port
|
37 |
EXPOSE 8501
|
38 |
|