ShivamKum4r's picture
Update Dockerfile
42bccda verified
FROM python:3.9-slim
# Set the working directory
WORKDIR /app
# Set home and streamlit config to avoid permission issues
ENV HOME="/app"
ENV STREAMLIT_HOME="/app/.streamlit"
ENV STREAMLIT_BROWSER_GATHERUSAGESTATS=false
# Install system dependencies required by RDKit and Streamlit
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libxrender1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libx11-6 \
&& rm -rf /var/lib/apt/lists/*
# Create Streamlit config directory and config file to disable usage stats
RUN mkdir -p /app/.streamlit && \
echo "[browser]\ngatherUsageStats = false" > /app/.streamlit/config.toml
# Upgrade pip
RUN pip install --upgrade pip
# Install PyTorch first to avoid build issues with torch-scatter
RUN pip install torch==2.1.2
# Install torch-scatter and torch-sparse with appropriate PyTorch compatibility
RUN pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.1.0+cpu.html
# Install all remaining dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Install additional dependencies that might be missing
RUN pip install plotly
# Copy all necessary files
COPY . ./
# Expose port and define entrypoint
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]