Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -14
Dockerfile
CHANGED
|
@@ -1,32 +1,37 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# 1. Install
|
| 5 |
-
# We
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
texlive-latex-base \
|
| 9 |
texlive-latex-extra \
|
| 10 |
-
texlive-science \
|
| 11 |
texlive-fonts-recommended \
|
| 12 |
texlive-fonts-extra \
|
|
|
|
|
|
|
| 13 |
ghostscript \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
# 2. Set
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
-
# 3. Copy
|
| 20 |
COPY requirements.txt .
|
| 21 |
-
|
| 22 |
-
# 4. Install Python dependencies
|
| 23 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
-
#
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
#
|
|
|
|
| 32 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# Start from a lightweight Python image
|
| 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 \
|
|
|
|
| 11 |
texlive-fonts-recommended \
|
| 12 |
texlive-fonts-extra \
|
| 13 |
+
texlive-science \
|
| 14 |
+
texlive-pictures \
|
| 15 |
ghostscript \
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
+
# 2. Set the working directory
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
+
# 3. Copy requirements and install Python libraries
|
| 22 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 23 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
+
# 4. Copy the rest of the app code
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
+
# 5. Create a non-root user (Security best practice for Hugging Face)
|
| 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 |
+
# 6. Command to run the app
|
| 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"]
|