# Gitea MCP Remote — Dockerfile # Multi-stage build for optimized image size FROM python:3.11-slim as builder # Set working directory WORKDIR /build # Install build dependencies including git for marketplace dependency RUN apt-get update && \ apt-get install -y --no-install-recommends \ gcc \ git \ && 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 (includes marketplace dependency from git) RUN pip install --user --no-cache-dir . # Production stage FROM python:3.11-slim # Install runtime dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* # 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 # Default to port 8080 (Caddy proxies to this) ENV HTTP_PORT=8080 ENV HTTP_HOST=0.0.0.0 # Expose port EXPOSE 8080 # Health check using curl HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Run the MCP server CMD ["gitea-mcp-remote"]