From b57e852c69733fa71f69e9051bfaa63bb2d09894 Mon Sep 17 00:00:00 2001 From: MohamedAlawakey Date: Tue, 30 Sep 2025 21:23:32 +0300 Subject: [PATCH] edit the docker file --- Dockerfile | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93b49e6..4827e7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,33 +3,32 @@ FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - UV_PROJECT_ENV=.venv - -ENV DEBIAN_FRONTEND=noninteractive + UV_PROJECT_ENV=.venv \ + DEBIAN_FRONTEND=noninteractive WORKDIR /app -# Install system tools + uv package manager +# Install tools + uv RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ && rm -rf /var/lib/apt/lists/* \ && curl -LsSf https://astral.sh/uv/install.sh | sh \ && ln -s /root/.local/bin/uv /usr/local/bin/uv -# Copy dependency files first to leverage Docker layer caching -COPY pyproject.toml uv.lock requirements.txt ./ +# Leverage caching for deps +COPY pyproject.toml uv.lock* requirements.txt* ./ -# Install dependencies in .venv with uv (cached layer) -RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --frozen --no-dev +# Install dependencies into the image (no runtime venv creation) +RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev -# Copy the rest of the source code +# Copy source COPY . . -# Add virtual environment to PATH +# Activate venv in PATH ENV PATH="/app/.venv/bin:${PATH}" -# Environment variable to be set at runtime -# ENV SERPER_API_KEY=your_key +# Health HTTP port for Ingress +ENV PORT=8000 +EXPOSE 8000 -# Default command to start MCP server via stdio -CMD ["uv","run","--with","mcp","mcp","run","server.py"] +# Simple HTTP health + FASTMCP over STDIO +CMD sh -c "python -m http.server ${PORT} & exec uv run --with mcp mcp run server.py"