Alamgirapi commited on
Commit
622bb7a
·
verified ·
1 Parent(s): d87ad37

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -12
Dockerfile CHANGED
@@ -2,25 +2,31 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Copy requirements first for better caching
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
- # Install Python dependencies
 
 
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Copy the rest of the application
 
 
 
 
17
  COPY . .
18
 
19
- # Expose the port
20
- EXPOSE 8501
 
 
21
 
22
- # Health check
23
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
24
 
25
- # Run the application
26
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
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"]