Spaces:
Sleeping

DataAnalysis / Dockerfile
cormort's picture
Update Dockerfile
8c65069 verified
Raw History Blame Contribute Delete
1.29 kB
FROM python:3.9-slim
# Set the working directory
WORKDIR /app
# Set environment variables for Streamlit and Matplotlib cache directories
# This directs Streamlit and Matplotlib to use the /tmp directory for cache/config files
ENV STREAMLIT_HOME="/tmp"
ENV MPLCONFIGDIR="/tmp"
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip and setuptools to ensure proper package installation and dependency resolution
RUN pip install --no-cache-dir --upgrade pip setuptools
# Copy requirements.txt and install Python dependencies
# Using --no-cache-dir to force fresh downloads and potentially rebuild wheels
# This can help resolve binary incompatibility issues like the numpy.dtype error
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy your Streamlit application file to the working directory
COPY app.py ./
# Expose the port Streamlit will run on
EXPOSE 8501
# Healthcheck to ensure the app is running
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Define the entrypoint for the application
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]