Spaces:
Sleeping
Sleeping
Changing Dockerfile to allow perms
Browse files- Dockerfile +22 -21
Dockerfile
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
# Install
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
build-essential \
|
| 9 |
curl \
|
| 10 |
git \
|
| 11 |
-
|
| 12 |
|
| 13 |
-
# Copy Python
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
-
# Copy
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
# Create
|
| 21 |
-
RUN mkdir -p /app/.streamlit
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
COPY .streamlit/config.toml /app/.streamlit/config.toml
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
ENV
|
| 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 |
-
#
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
# Run Streamlit
|
| 41 |
-
ENTRYPOINT ["streamlit", "run", "KPI_Dashboard.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# Base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Copy requirements and install Python packages
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy app source code
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
+
# Create necessary folders with full permissions
|
| 22 |
+
RUN mkdir -p /app/.streamlit \
|
| 23 |
+
/app/.config/matplotlib \
|
| 24 |
+
/app/.cache \
|
| 25 |
+
/app/outputs \
|
| 26 |
+
&& chmod -R 777 /app/.streamlit \
|
| 27 |
+
/app/.config \
|
| 28 |
+
/app/.cache \
|
| 29 |
+
/app/outputs \
|
| 30 |
+
/tmp
|
| 31 |
+
|
| 32 |
+
# Copy Streamlit config if you have one
|
| 33 |
COPY .streamlit/config.toml /app/.streamlit/config.toml
|
| 34 |
|
| 35 |
+
# Set environment variable for Matplotlib to use writable directory
|
| 36 |
+
ENV MPLCONFIGDIR=/app/.config/matplotlib
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
# Expose Streamlit default port
|
| 39 |
EXPOSE 8501
|
| 40 |
|
| 41 |
+
# Command to run Streamlit app
|
| 42 |
+
CMD ["streamlit", "run", "app.py"]
|
|
|
|
|
|
|
|
|