update fastapi app
This commit is contained in:
+186
@@ -0,0 +1,186 @@
|
|||||||
|
# flyctl launch added from .gitignore
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
**/__pycache__
|
||||||
|
**/*.py[cod]
|
||||||
|
**/*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
**/*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
**/.Python
|
||||||
|
**/build
|
||||||
|
**/develop-eggs
|
||||||
|
**/dist
|
||||||
|
**/downloads
|
||||||
|
**/eggs
|
||||||
|
**/.eggs
|
||||||
|
**/lib
|
||||||
|
**/lib64
|
||||||
|
**/parts
|
||||||
|
**/sdist
|
||||||
|
**/var
|
||||||
|
**/wheels
|
||||||
|
**/share/python-wheels
|
||||||
|
**/*.egg-info
|
||||||
|
**/.installed.cfg
|
||||||
|
**/*.egg
|
||||||
|
**/MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
**/*.manifest
|
||||||
|
**/*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
**/pip-log.txt
|
||||||
|
**/pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
**/htmlcov
|
||||||
|
**/.tox
|
||||||
|
**/.nox
|
||||||
|
**/.coverage
|
||||||
|
**/.coverage.*
|
||||||
|
**/.cache
|
||||||
|
**/nosetests.xml
|
||||||
|
**/coverage.xml
|
||||||
|
**/*.cover
|
||||||
|
**/*.py,cover
|
||||||
|
**/.hypothesis
|
||||||
|
**/.pytest_cache
|
||||||
|
**/cover
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
**/*.mo
|
||||||
|
**/*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
**/*.log
|
||||||
|
**/local_settings.py
|
||||||
|
**/db.sqlite3
|
||||||
|
**/db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
**/instance
|
||||||
|
**/.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
**/.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
**/docs/_build
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
**/.pybuilder
|
||||||
|
**/target
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
**/.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
**/profile_default
|
||||||
|
**/ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
**/.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
**/__pypackages__
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
**/celerybeat-schedule
|
||||||
|
**/celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
**/*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
**/.env
|
||||||
|
**/.venv
|
||||||
|
**/env
|
||||||
|
**/venv
|
||||||
|
**/ENV
|
||||||
|
**/env.bak
|
||||||
|
**/venv.bak
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
**/.spyderproject
|
||||||
|
**/.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
**/.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
**/.mypy_cache
|
||||||
|
**/.dmypy.json
|
||||||
|
**/dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
**/.pyre
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
**/.pytype
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
**/cython_debug
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
|
**/.DS_Store
|
||||||
|
**/hello.py
|
||||||
|
|
||||||
|
**/*.html
|
||||||
|
**/fast-mcp-docs.md
|
||||||
|
|
||||||
|
# Debug and test files
|
||||||
|
**/debug_*
|
||||||
|
**/test_*
|
||||||
|
**/CLAUDE.md
|
||||||
|
|
||||||
|
# ASGI/Deployment files
|
||||||
|
**/ssl
|
||||||
|
**/*.pem
|
||||||
|
**/*.key
|
||||||
|
**/*.crt
|
||||||
|
|
||||||
|
# Docker volumes
|
||||||
|
**/redis-data
|
||||||
|
|
||||||
|
# Production logs
|
||||||
|
**/logs/*.log.*
|
||||||
|
**/Dockerfile
|
||||||
|
**/Dockerfile
|
||||||
|
fly.toml
|
||||||
@@ -180,3 +180,7 @@ redis-data/
|
|||||||
|
|
||||||
# Production logs
|
# Production logs
|
||||||
logs/*.log.*
|
logs/*.log.*
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile
|
||||||
|
fly.toml
|
||||||
|
.github/workflows/fly-deploy.yml
|
||||||
|
|||||||
+14
-73
@@ -1,86 +1,27 @@
|
|||||||
# Multi-stage Dockerfile for Yargı MCP Server
|
# ---------- temel imaj ----------
|
||||||
|
|
||||||
# Build stage
|
|
||||||
FROM python:3.12-slim as builder
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
gcc \
|
|
||||||
g++ \
|
|
||||||
git \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy requirements first for better caching
|
|
||||||
COPY pyproject.toml ./
|
|
||||||
COPY README.md ./
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN pip install --no-cache-dir uv && \
|
|
||||||
uv pip install --system --no-cache-dir .
|
|
||||||
|
|
||||||
# Runtime stage
|
|
||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Playwright’in istediği kitaplıklar
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
# Required for Playwright
|
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
|
||||||
libnss3 \
|
libdrm2 libdbus-1-3 libatspi2.0-0 libx11-6 libxcomposite1 \
|
||||||
libnspr4 \
|
libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxcb1 \
|
||||||
libatk1.0-0 \
|
libxkbcommon0 libpango-1.0-0 libcairo2 libasound2 \
|
||||||
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/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create non-root user
|
|
||||||
RUN useradd -m -u 1000 mcp && \
|
|
||||||
mkdir -p /app && \
|
|
||||||
chown -R mcp:mcp /app
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy from builder
|
# Gereksinimler
|
||||||
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
COPY requirements.txt .
|
||||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy application code
|
# Uygulama dosyaları
|
||||||
COPY --chown=mcp:mcp . .
|
COPY . .
|
||||||
|
|
||||||
# Install Playwright browsers
|
# Playwright tarayıcılarını kur
|
||||||
RUN playwright install chromium
|
RUN playwright install chromium
|
||||||
|
|
||||||
# Switch to non-root user
|
ENV PYTHONUNBUFFERED=1
|
||||||
USER mcp
|
|
||||||
|
|
||||||
# Expose port
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Set environment variables
|
CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
ENV PORT=8000
|
|
||||||
|
|
||||||
# Health check
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
||||||
CMD python -c "import httpx; httpx.get('http://localhost:8000/health').raise_for_status()"
|
|
||||||
|
|
||||||
# Run the ASGI server
|
|
||||||
CMD ["uvicorn", "asgi_app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
||||||
|
|||||||
+770
-132
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user