Doiiars
Committed by GitHub

Merge pull request #114 from luojiyin1987/improve-dockerfile-build

Improve Dockerfile build configuration and layer caching
Showing 1 changed file with 14 additions and 10 deletions
FROM python:3.11-slim
# Prevent Python from writing .pyc files and buffer stdout/stderr
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Prevent Python from writing .pyc files, buffer stdout/stderr, and pin common tooling paths
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
PIP_NO_CACHE_DIR=1 \
PATH="/root/.local/bin:${PATH}" \
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
# Install system dependencies required by scientific Python stack, Playwright, and Streamlit
RUN apt-get update && apt-get install -y --no-install-recommends \
... ... @@ -34,24 +38,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install uv and expose it on PATH
ENV PATH="/root/.local/bin:${PATH}"
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# Install the latest uv release and expose it on PATH
RUN curl -LsSf --retry 3 --retry-delay 2 --proto '=https' --proto-redir '=https' --tlsv1.2 https://astral.sh/uv/install.sh | sh
WORKDIR /app
# Install Python dependencies first to leverage Docker layer caching
COPY requirements.txt ./
RUN uv pip install --system -r requirements.txt && \
python -m playwright install chromium
COPY requirements.txt ./
RUN uv pip install --system -r requirements.txt
# Install Playwright browser binaries (system deps already handled above)
RUN python -m playwright install chromium
# Copy application source
COPY . .
# Ensure runtime directories exist even if ignored in build context
RUN mkdir -p logs final_reports insight_engine_streamlit_reports media_engine_streamlit_reports query_engine_streamlit_reports
RUN mkdir -p /ms-playwright logs final_reports insight_engine_streamlit_reports media_engine_streamlit_reports query_engine_streamlit_reports
# Expose Flask and Streamlit ports
EXPOSE 5000 8501 8502 8503
# Default command launches the Flask orchestrator which starts Streamlit agents
... ...