alidenewade's picture
Update Dockerfile
3a7a428 verified
raw
history blame
1.16 kB
# Use Python 3.9 slim image as base
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies required for RDKit and other packages
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt-dev \
libxrender1 \
libxext6 \
libfontconfig1 \
libcairo2-dev \
libpango1.0-dev \
libgdk-pixbuf2.0-dev \
libgtk-3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better Docker layer caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Create a non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose the port that Streamlit uses
EXPOSE 7860
# Set environment variables for Streamlit
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_PORT=7860
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Command to run the application
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]