Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -8
Dockerfile
CHANGED
|
@@ -1,18 +1,16 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
|
| 7 |
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
# Copy requirements
|
| 13 |
COPY requirements.txt .
|
| 14 |
-
|
| 15 |
-
# Install Python dependencies with specific NumPy version first
|
| 16 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 17 |
pip install --no-cache-dir "numpy<2.0.0" && \
|
| 18 |
pip install --no-cache-dir -r requirements.txt
|
|
@@ -20,6 +18,10 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
| 20 |
# Copy the application code
|
| 21 |
COPY . .
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Expose the port that Streamlit runs on
|
| 24 |
EXPOSE 7860
|
| 25 |
|
|
@@ -29,8 +31,5 @@ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
|
| 29 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 30 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
| 31 |
|
| 32 |
-
# Health check
|
| 33 |
-
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
|
| 34 |
-
|
| 35 |
# Run the Streamlit app
|
| 36 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# Use the official Hugging Face Spaces base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
+
WORKDIR /home/user/app
|
| 6 |
|
| 7 |
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Copy requirements and install Python dependencies
|
| 13 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 14 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 15 |
pip install --no-cache-dir "numpy<2.0.0" && \
|
| 16 |
pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 18 |
# Copy the application code
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
+
# Create user
|
| 22 |
+
RUN useradd -m -u 1000 user
|
| 23 |
+
USER user
|
| 24 |
+
|
| 25 |
# Expose the port that Streamlit runs on
|
| 26 |
EXPOSE 7860
|
| 27 |
|
|
|
|
| 31 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
| 32 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
# Run the Streamlit app
|
| 35 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|