feat(deploy): add minimal ASGI app and Dockerfile for simple deploys

Mirrors the mevzuat-mcp pattern: a thin app.py exposing
mcp.http_app() with a /health route, no FastAPI/CORS/OAuth wrapper.
Dockerfile builds on python:3.12-slim and runs uvicorn directly.
Removes Dockerfile/fly.toml entries from .dockerignore so the new
Dockerfile is included in the build context.

Existing asgi_app.py (api.yargimcp.com production) is untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
saidsurucu
2026-05-07 13:13:22 +03:00
co-authored by Claude Opus 4.7
parent 6b781b61d2
commit a24def2e66
3 changed files with 88 additions and 3 deletions
-3
View File
@@ -181,6 +181,3 @@ site
# Production logs
**/logs/*.log.*
**/Dockerfile
**/Dockerfile
fly.toml
+53
View File
@@ -0,0 +1,53 @@
# Use Python 3.12 slim image
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies (gcc/g++ kept in case any wheel falls back to source build)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy project metadata first for better Docker layer caching
COPY pyproject.toml ./
COPY README.md ./
# Copy entry points
COPY app.py ./
COPY asgi_app.py ./
COPY mcp_server_main.py ./
# Copy MCP modules and shared packages
COPY anayasa_mcp_module ./anayasa_mcp_module
COPY bddk_mcp_module ./bddk_mcp_module
COPY bedesten_mcp_module ./bedesten_mcp_module
COPY danistay_mcp_module ./danistay_mcp_module
COPY emsal_mcp_module ./emsal_mcp_module
COPY gib_mcp_module ./gib_mcp_module
COPY kik_mcp_module ./kik_mcp_module
COPY kvkk_mcp_module ./kvkk_mcp_module
COPY rekabet_mcp_module ./rekabet_mcp_module
COPY sayistay_mcp_module ./sayistay_mcp_module
COPY sigorta_tahkim_mcp_module ./sigorta_tahkim_mcp_module
COPY uyusmazlik_mcp_module ./uyusmazlik_mcp_module
COPY yargitay_mcp_module ./yargitay_mcp_module
COPY semantic_search ./semantic_search
# Install the package with ASGI extras (uvicorn + starlette)
RUN pip install --no-cache-dir -e ".[asgi]"
# Expose port
EXPOSE 8000
# Set environment variables
ENV PORT=8000
ENV PYTHONUNBUFFERED=1
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8000/health', timeout=5)" || exit 1
# Run the ASGI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
+35
View File
@@ -0,0 +1,35 @@
"""
ASGI application for Yargı MCP Server (simple deployment variant).
This is a minimal ASGI application that can be run with:
uvicorn app:app --host 0.0.0.0 --port 8000
The MCP server will be available at:
http://localhost:8000/mcp/
For the FastAPI-wrapped variant with CORS and extra metadata routes,
see asgi_app.py instead.
"""
from starlette.responses import JSONResponse
from mcp_server_main import create_app
mcp = create_app()
@mcp.custom_route("/health", methods=["GET"])
async def health_check(request):
"""Health check endpoint for monitoring services (Fly.io, Render, etc.)."""
return JSONResponse({
"status": "healthy",
"service": "Yargı MCP Server",
"version": "0.2.0",
})
# Create ASGI app directly from FastMCP server
app = mcp.http_app()
# Endpoints:
# - /mcp/ - MCP server (Streamable HTTP transport, default FastMCP path)
# - /health - Health check for monitoring