add saas files

This commit is contained in:
saidsurucu
2025-06-29 14:31:37 +03:00
parent 352969deca
commit 973a25980b
9 changed files with 153 additions and 39 deletions
+24 -22
View File
@@ -1,31 +1,33 @@
# ---------- temel imaj ----------
FROM python:3.12-slim
# Playwrightin istediği kitaplıklar
RUN apt-get update && apt-get install -y \
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
libdrm2 libdbus-1-3 libatspi2.0-0 libx11-6 libxcomposite1 \
libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxcb1 \
libxkbcommon0 libpango-1.0-0 libcairo2 libasound2 \
&& rm -rf /var/lib/apt/lists/*
# -------- BASE IMAGE (includes Chromium & deps) ----------------------------
FROM mcr.microsoft.com/playwright/python:v1.52.0-jammy # Playwright docs
# -------- Runtime setup ----------------------------------------------------
WORKDIR /app
# Gereksinimler
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy dependency manifests first for layer-cache
COPY pyproject.toml poetry.lock* requirements*.txt* ./
# Uygulama dosyaları
# Fast, deterministic install with `uv`
RUN pip install --no-cache-dir uv && \
uv pip install --system --no-cache-dir .[asgi] # installs FastMCP, FastAPI
# Copy application source
COPY . .
# Python path ayarı (import sorunlarını önler)
ENV PYTHONPATH=/app
# Playwright tarayıcılarını kur
RUN playwright install chromium
# -------- Environment ------------------------------------------------------
ENV PYTHONUNBUFFERED=1
ENV ENABLE_AUTH=true # Clerk JWT validation ON by default
ENV PORT=8000
# -------- Health check -----------------------------------------------------
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD python - <<'PY'
import httpx, os, sys; \
r=httpx.get(f"http://localhost:{os.getenv('PORT','8000')}/health"); \
sys.exit(0 if r.status_code==200 else 1)
PY
EXPOSE 8000
CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]
# -------- Entrypoint -------------------------------------------------------
CMD ["uvicorn", "asgi_app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]