Update Dockerfile
Browse files- Dockerfile +11 -7
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# 1. Use an official lightweight Python image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# 2. Set environment variables
|
| 5 |
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
|
@@ -14,7 +14,7 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 14 |
# 4. Set the working directory
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
# 5. Install system dependencies
|
| 18 |
USER root
|
| 19 |
RUN apt-get update && apt-get install -y \
|
| 20 |
git \
|
|
@@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y \
|
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
USER user
|
| 24 |
|
| 25 |
-
# 6. Copy requirements first
|
| 26 |
COPY --chown=user requirements.txt ./
|
| 27 |
|
| 28 |
# 7. Install Python dependencies
|
|
@@ -30,11 +30,15 @@ RUN pip install --upgrade pip && \
|
|
| 30 |
pip install -r requirements.txt
|
| 31 |
|
| 32 |
# 8. Copy the rest of the application files
|
| 33 |
-
# This includes app.py and your .pkl model files
|
| 34 |
COPY --chown=user . .
|
| 35 |
|
| 36 |
-
# 9. Expose the port
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
-
# 10. Run the Streamlit app
|
| 40 |
-
CMD ["streamlit", "run", "app.py",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# 1. Use an official lightweight Python image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# 2. Set environment variables
|
| 5 |
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
|
|
|
| 14 |
# 4. Set the working directory
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# 5. Install system dependencies
|
| 18 |
USER root
|
| 19 |
RUN apt-get update && apt-get install -y \
|
| 20 |
git \
|
|
|
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
USER user
|
| 24 |
|
| 25 |
+
# 6. Copy requirements first
|
| 26 |
COPY --chown=user requirements.txt ./
|
| 27 |
|
| 28 |
# 7. Install Python dependencies
|
|
|
|
| 30 |
pip install -r requirements.txt
|
| 31 |
|
| 32 |
# 8. Copy the rest of the application files
|
|
|
|
| 33 |
COPY --chown=user . .
|
| 34 |
|
| 35 |
+
# 9. Expose the port
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
+
# 10. Run the Streamlit app (WITH THE SECURITY FIXES)
|
| 39 |
+
CMD ["streamlit", "run", "app.py", \
|
| 40 |
+
"--server.address", "0.0.0.0", \
|
| 41 |
+
"--server.port", "7860", \
|
| 42 |
+
"--server.enableXsrfProtection=false", \
|
| 43 |
+
"--server.enableCORS=false", \
|
| 44 |
+
"--server.fileWatcherType", "none"]
|