Update Dockerfile
Browse files- Dockerfile +7 -17
Dockerfile
CHANGED
|
@@ -1,11 +1,8 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Create non-root user
|
| 4 |
-
RUN useradd -m streamlituser
|
| 5 |
-
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# Install system dependencies
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
build-essential \
|
| 11 |
curl \
|
|
@@ -14,23 +11,16 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
libgl1 \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
# Set up config
|
| 18 |
-
RUN mkdir -p /app/.streamlit /app/.config
|
| 19 |
-
chown -R streamlituser:streamlituser /app
|
| 20 |
-
|
| 21 |
-
# Set environment variables
|
| 22 |
ENV HOME=/app
|
| 23 |
ENV XDG_CONFIG_HOME=/app/.config
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Copy files after switching to the user to preserve ownership
|
| 29 |
-
COPY --chown=streamlituser:streamlituser requirements.txt ./
|
| 30 |
-
COPY --chown=streamlituser:streamlituser src/ ./src/
|
| 31 |
|
| 32 |
-
# Install dependencies
|
| 33 |
-
RUN
|
| 34 |
|
| 35 |
EXPOSE 8501
|
| 36 |
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies including libgl1 (fixes ImportError)
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
|
|
|
| 11 |
libgl1 \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Set up writable config directories to fix PermissionError
|
| 15 |
+
RUN mkdir -p /app/.streamlit /app/.config
|
|
|
|
|
|
|
|
|
|
| 16 |
ENV HOME=/app
|
| 17 |
ENV XDG_CONFIG_HOME=/app/.config
|
| 18 |
|
| 19 |
+
COPY requirements.txt ./
|
| 20 |
+
COPY src/ ./src/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
# Install Python dependencies
|
| 23 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
EXPOSE 8501
|
| 26 |
|