Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +21 -5
Dockerfile
CHANGED
|
@@ -1,17 +1,30 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
COPY requirements.txt .
|
| 7 |
|
| 8 |
# Install Python dependencies
|
| 9 |
-
RUN
|
| 10 |
|
| 11 |
# Copy application code
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
EXPOSE 8501
|
| 16 |
|
| 17 |
# Configure Streamlit
|
|
@@ -21,5 +34,8 @@ ENV STREAMLIT_SERVER_ENABLEXSRFPROTECTION=false
|
|
| 21 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
| 22 |
ENV STREAMLIT_SERVER_PORT=8501
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
CMD
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Install system dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
build-essential \
|
| 9 |
+
curl \
|
| 10 |
+
software-properties-common \
|
| 11 |
+
git \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# Copy requirements first for better caching
|
| 15 |
COPY requirements.txt .
|
| 16 |
|
| 17 |
# Install Python dependencies
|
| 18 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
# Copy application code
|
| 21 |
COPY . .
|
| 22 |
|
| 23 |
+
# Create non-root user for security
|
| 24 |
+
RUN useradd -m -u 1000 streamlit
|
| 25 |
+
USER streamlit
|
| 26 |
+
|
| 27 |
+
# Expose port
|
| 28 |
EXPOSE 8501
|
| 29 |
|
| 30 |
# Configure Streamlit
|
|
|
|
| 34 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
| 35 |
ENV STREAMLIT_SERVER_PORT=8501
|
| 36 |
|
| 37 |
+
# Health check
|
| 38 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 39 |
+
|
| 40 |
+
# Run the application
|
| 41 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType=none", "--browser.gatherUsageStats=false"]
|