louiecerv's picture
save
a2495f2
raw
history blame contribute delete
937 Bytes
FROM python:3.9-slim-buster
# Set environment variables for Streamlit and Matplotlib
ENV STREAMLIT_SERVER_PORT=8501
ENV MPLCONFIGDIR=/tmp/matplotlib_cache
# Create a non-root user for security (optional but good practice)
# And set ownership of the app directory if needed
# RUN useradd -m streamlit_user
# USER streamlit_user
# WORKDIR /home/streamlit_user/app
WORKDIR /app
# Copy requirements.txt and install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
# Copy your Streamlit app and configuration
COPY . .
# Create the matplotlib cache directory with appropriate permissions
RUN mkdir -p ${MPLCONFIGDIR} && chmod -R 777 ${MPLCONFIGDIR}
# Make sure /tmp is also writable by everyone if not already (often is by default)
RUN chmod -R 777 /tmp
EXPOSE 8501
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]