Man0707 commited on
Commit
da4d8e0
·
verified ·
1 Parent(s): ea31469

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -20
Dockerfile CHANGED
@@ -1,32 +1,20 @@
1
- # Use lightweight official Python image
2
  FROM python:3.11-slim
3
 
4
- # Prevent Python from writing .pyc files and enable buffering
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
-
8
- # Set working directory inside container
9
  WORKDIR /app
10
 
11
- # Copy only requirements first (best practice for caching)
12
  COPY requirements.txt .
13
 
14
- # Install dependencies (fast & clean)
15
- RUN pip install --no-cache-dir --upgrade pip && \
16
- pip install --no-cache-dir -r requirements.txt
17
 
18
- # Copy your entire app (code + model files)
19
  COPY . .
20
 
21
- # Create a non-root user (security best practice)
22
- RUN useradd -m appuser && chown -R appuser:appuser /app
23
- USER appuser
24
-
25
  # Expose Streamlit port
26
  EXPOSE 8501
27
 
28
- # Health check (optional but recommended)
29
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
30
-
31
- # Run Streamlit app
32
- CMD ["streamlit", "run", "mushroom_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
 
1
+ # Use lightweight Python image
2
  FROM python:3.11-slim
3
 
4
+ # Set working directory
 
 
 
 
5
  WORKDIR /app
6
 
7
+ # Copy requirements first (for better caching)
8
  COPY requirements.txt .
9
 
10
+ # Install dependencies (super fast, no cache)
11
+ RUN pip install --no-cache-dir -r requirements.txt
 
12
 
13
+ # Copy your app code
14
  COPY . .
15
 
 
 
 
 
16
  # Expose Streamlit port
17
  EXPOSE 8501
18
 
19
+ # Run the correct file name: app.py
20
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]