# Gitea HTTP MCP Wrapper Dockerfile # Multi-stage build for optimized image size FROM python:3.11-slim as builder # Set working directory WORKDIR /build # Install build dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . RUN pip install --user --no-cache-dir -r requirements.txt # Copy source code COPY pyproject.toml . COPY src/ src/ # Install package RUN pip install --user --no-cache-dir -e . # Production stage FROM python:3.11-slim # Set working directory WORKDIR /app # Copy installed packages from builder COPY --from=builder /root/.local /root/.local # Copy source code COPY src/ src/ COPY pyproject.toml . # Make sure scripts in .local are usable ENV PATH=/root/.local/bin:$PATH # Set Python environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Expose default port EXPOSE 8000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()" # Run the HTTP MCP server CMD ["gitea-http-wrapper"]