Spaces:
Sleeping
Sleeping
Adding permissions within Dockerfile
Browse files- Dockerfile +12 -7
Dockerfile
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# Use official lightweight Python image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set working directory
|
|
@@ -18,15 +17,21 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 18 |
# Copy project files
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
RUN mkdir -p /
|
| 23 |
-
&& cp -r .streamlit/* /root/.streamlit/ \
|
| 24 |
-
&& chmod 600 /root/.streamlit/config.toml
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
EXPOSE 8501
|
| 28 |
|
| 29 |
-
# Healthcheck
|
| 30 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 31 |
|
| 32 |
# Run Streamlit
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
# Set working directory
|
|
|
|
| 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 to writable location
|
| 24 |
+
COPY .streamlit/config.toml /app/.streamlit/config.toml
|
| 25 |
+
|
| 26 |
+
# Set environment variables so Streamlit & Matplotlib use writable dirs
|
| 27 |
+
ENV STREAMLIT_CONFIG_PATH=/app/.streamlit/config.toml \
|
| 28 |
+
STREAMLIT_RUNTIME_DIR=/app/.streamlit \
|
| 29 |
+
MPLCONFIGDIR=/app/.config/matplotlib
|
| 30 |
+
|
| 31 |
+
# Expose port for Streamlit
|
| 32 |
EXPOSE 8501
|
| 33 |
|
| 34 |
+
# Healthcheck
|
| 35 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 36 |
|
| 37 |
# Run Streamlit
|