Update Dockerfile
Browse files- Dockerfile +8 -20
Dockerfile
CHANGED
|
@@ -1,32 +1,20 @@
|
|
| 1 |
-
# Use lightweight
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
-
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
|
| 8 |
-
# Set working directory inside container
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Copy
|
| 12 |
COPY requirements.txt .
|
| 13 |
|
| 14 |
-
# Install dependencies (fast
|
| 15 |
-
RUN pip install --no-cache-dir
|
| 16 |
-
pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
-
# Copy your
|
| 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 |
-
#
|
| 29 |
-
|
| 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"]
|
|
|
|
|
|
|
|
|