Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +56 -25
Dockerfile
CHANGED
|
@@ -1,25 +1,56 @@
|
|
| 1 |
-
# Use a minimal Python base image
|
| 2 |
-
FROM python:3.9-slim
|
| 3 |
-
|
| 4 |
-
# Set working directory inside the container
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Copy requirements first for caching
|
| 8 |
-
COPY requirements.txt .
|
| 9 |
-
|
| 10 |
-
# Install dependencies
|
| 11 |
-
RUN pip install --upgrade pip && \
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# Copy all files into the container
|
| 15 |
-
COPY . .
|
| 16 |
-
|
| 17 |
-
# Expose Streamlit's default port
|
| 18 |
-
EXPOSE 8501
|
| 19 |
-
|
| 20 |
-
# Run the Streamlit app
|
| 21 |
-
# This passes the NVIDIA_API_KEY from the Hugging Face Space Secrets
|
| 22 |
-
CMD ["streamlit", "run", "data_analysis_agent.py", \
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# # Use a minimal Python base image
|
| 2 |
+
# FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# # Set working directory inside the container
|
| 5 |
+
# WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# # Copy requirements first for caching
|
| 8 |
+
# COPY requirements.txt .
|
| 9 |
+
|
| 10 |
+
# # Install dependencies
|
| 11 |
+
# RUN pip install --upgrade pip && \
|
| 12 |
+
# pip install -r requirements.txt
|
| 13 |
+
|
| 14 |
+
# # Copy all files into the container
|
| 15 |
+
# COPY . .
|
| 16 |
+
|
| 17 |
+
# # Expose Streamlit's default port
|
| 18 |
+
# EXPOSE 8501
|
| 19 |
+
|
| 20 |
+
# # Run the Streamlit app
|
| 21 |
+
# # This passes the NVIDIA_API_KEY from the Hugging Face Space Secrets
|
| 22 |
+
# CMD ["streamlit", "run", "data_analysis_agent.py", \
|
| 23 |
+
# "--server.port=8501", \
|
| 24 |
+
# "--server.address=0.0.0.0", \
|
| 25 |
+
# "--server.enableXsrfProtection=false"]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
FROM python:3.9-slim
|
| 29 |
+
|
| 30 |
+
RUN useradd -m -u 1000 user
|
| 31 |
+
USER user
|
| 32 |
+
ENV HOME=/home/user \
|
| 33 |
+
PATH=/home/user/.local/bin:$PATH
|
| 34 |
+
WORKDIR $HOME/app
|
| 35 |
+
COPY --chown=user . $HOME/app
|
| 36 |
+
|
| 37 |
+
# Run apt-get update and install as root
|
| 38 |
+
USER root
|
| 39 |
+
RUN apt-get update && apt-get install -y \
|
| 40 |
+
build-essential \
|
| 41 |
+
curl \
|
| 42 |
+
software-properties-common \
|
| 43 |
+
git \
|
| 44 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 45 |
+
USER user
|
| 46 |
+
|
| 47 |
+
# COPY requirements.txt ./
|
| 48 |
+
# COPY src/ ./src/
|
| 49 |
+
COPY . .
|
| 50 |
+
|
| 51 |
+
RUN pip3 install -r requirements.txt
|
| 52 |
+
|
| 53 |
+
EXPOSE 8501
|
| 54 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 55 |
+
|
| 56 |
+
ENTRYPOINT ["streamlit", "run", "data_analysis_agent.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|