Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -12
Dockerfile
CHANGED
|
@@ -2,25 +2,31 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
COPY requirements.txt .
|
| 7 |
-
|
| 8 |
-
# Install system dependencies if needed
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
build-essential \
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
CMD ["streamlit", "run", "app.py", "--server.port=
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
+
curl \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Copy requirements and install Python packages
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
RUN pip install --upgrade pip
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
+
# Verify streamlit is installed and accessible
|
| 17 |
+
RUN which streamlit
|
| 18 |
+
RUN streamlit --version
|
| 19 |
+
|
| 20 |
+
# Copy application code
|
| 21 |
COPY . .
|
| 22 |
|
| 23 |
+
# Create a non-root user (optional but recommended)
|
| 24 |
+
RUN useradd --create-home --shell /bin/bash appuser
|
| 25 |
+
RUN chown -R appuser:appuser /app
|
| 26 |
+
USER appuser
|
| 27 |
|
| 28 |
+
# Expose port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
|
| 31 |
+
# Command to run the application
|
| 32 |
+
CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]
|