Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -13
Dockerfile
CHANGED
|
@@ -2,9 +2,6 @@
|
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# 1. Install LaTeX and dependencies
|
| 5 |
-
# We run 'apt-get update' and install all necessary TeX Live packages
|
| 6 |
-
# 'texlive-science' is needed for your siunitx package
|
| 7 |
-
# 'texlive-pictures' is needed for your pgfplots package
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
texlive-latex-base \
|
| 10 |
texlive-latex-extra \
|
|
@@ -15,23 +12,25 @@ RUN apt-get update && apt-get install -y \
|
|
| 15 |
ghostscript \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
-
# 2.
|
|
|
|
|
|
|
|
|
|
| 19 |
WORKDIR /app
|
|
|
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
COPY requirements.txt .
|
| 23 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
# This prevents permission errors
|
| 30 |
-
RUN useradd -m -u 1000 user
|
| 31 |
USER user
|
| 32 |
ENV HOME=/home/user \
|
| 33 |
PATH=/home/user/.local/bin:$PATH
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
# Streamlit runs on port 8501 by default, but HF expects 7860
|
| 37 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# 1. Install LaTeX and dependencies
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
texlive-latex-base \
|
| 7 |
texlive-latex-extra \
|
|
|
|
| 12 |
ghostscript \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# 2. Create a non-root user FIRST
|
| 16 |
+
RUN useradd -m -u 1000 user
|
| 17 |
+
|
| 18 |
+
# 3. Set the working directory and ensure the user owns it
|
| 19 |
WORKDIR /app
|
| 20 |
+
RUN chown user:user /app
|
| 21 |
|
| 22 |
+
# 4. Copy requirements and install dependencies
|
| 23 |
+
COPY --chown=user:user requirements.txt .
|
| 24 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
+
# 5. Copy the rest of the application with correct ownership
|
| 27 |
+
# (This is the CRITICAL fix)
|
| 28 |
+
COPY --chown=user:user . .
|
| 29 |
|
| 30 |
+
# 6. Switch to the non-root user
|
|
|
|
|
|
|
| 31 |
USER user
|
| 32 |
ENV HOME=/home/user \
|
| 33 |
PATH=/home/user/.local/bin:$PATH
|
| 34 |
|
| 35 |
+
# 7. Run the application
|
|
|
|
| 36 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|