Spaces:
Sleeping
Sleeping
Adding config execution to Dockerfile
Browse files- Dockerfile +11 -8
Dockerfile
CHANGED
|
@@ -10,29 +10,32 @@ RUN apt-get update && apt-get install -y \
|
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Copy
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
# Copy project files
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
# Create writable config/cache dirs
|
| 21 |
-
RUN mkdir -p /app/.streamlit /app/.config/matplotlib
|
|
|
|
| 22 |
|
| 23 |
-
# Copy Streamlit config
|
| 24 |
COPY .streamlit/config.toml /app/.streamlit/config.toml
|
| 25 |
|
| 26 |
-
#
|
| 27 |
ENV STREAMLIT_CONFIG_PATH=/app/.streamlit/config.toml \
|
| 28 |
STREAMLIT_RUNTIME_DIR=/app/.streamlit \
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
# Expose port
|
| 32 |
EXPOSE 8501
|
| 33 |
|
| 34 |
# Healthcheck
|
| 35 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 36 |
|
| 37 |
# Run Streamlit
|
| 38 |
-
ENTRYPOINT ["streamlit", "run", "KPI_Dashboard.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Copy Python dependencies
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
# Copy project files
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
+
# Create writable config/cache dirs and give full permissions
|
| 21 |
+
RUN mkdir -p /app/.streamlit /app/.config/matplotlib /app/.cache \
|
| 22 |
+
&& chmod -R 777 /app/.streamlit /app/.config /app/.cache /tmp
|
| 23 |
|
| 24 |
+
# Copy your Streamlit config into writable directory
|
| 25 |
COPY .streamlit/config.toml /app/.streamlit/config.toml
|
| 26 |
|
| 27 |
+
# Environment variables to redirect all writes to writable dirs
|
| 28 |
ENV STREAMLIT_CONFIG_PATH=/app/.streamlit/config.toml \
|
| 29 |
STREAMLIT_RUNTIME_DIR=/app/.streamlit \
|
| 30 |
+
STREAMLIT_CACHE_DIR=/app/.cache \
|
| 31 |
+
MPLCONFIGDIR=/app/.config/matplotlib \
|
| 32 |
+
HOME=/app
|
| 33 |
|
| 34 |
+
# Expose port
|
| 35 |
EXPOSE 8501
|
| 36 |
|
| 37 |
# Healthcheck
|
| 38 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 39 |
|
| 40 |
# Run Streamlit
|
| 41 |
+
ENTRYPOINT ["streamlit", "run", "KPI_Dashboard.py", "--server.port=8501", "--server.address=0.0.0.0"]
|