# Start from a Python base image | |
FROM python:3.10-slim | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
# Set work directory | |
WORKDIR /app | |
# Install build tools and system dependencies | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
gcc \ | |
g++ \ | |
git \ | |
curl \ | |
wget \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Upgrade pip | |
RUN pip install --upgrade pip | |
# Install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy app source | |
COPY . . | |
# Expose Streamlit port | |
EXPOSE 8501 | |
# Set Streamlit to run on all interfaces | |
ENV STREAMLIT_SERVER_HEADLESS=true | |
ENV STREAMLIT_SERVER_PORT=8501 | |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 | |
# Default command to run the app | |
CMD ["streamlit", "run", "app.py"] | |