Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

Add HTTP streamable MCP server docker container (#117)

Nico Laeser6ac072c7fd76
diff --git a/.dockerignore b/.dockerignore
index a4948d3..8bcd201 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,14 +1,54 @@
-.venv/
-**/__pycache__/
-*.pyc
-*.pyo
-.pytest_cache/
-.ruff_cache/
-.mypy_cache/
+# Version control
+.git/
+.gitignore
+
+# Python artifacts
+__pycache__/
+*.py[cod]
*.egg-info/
+*.egg
+.eggs/
dist/
build/
+wheels/
+
+# Virtual environments
+.venv/
+venv/
+env/
+
+# Test & coverage
+tests/
+.pytest_cache/
.coverage
+.coverage.*
htmlcov/
+coverage.xml
junit.xml
+
+# Dev tooling
+.ruff_cache/
+.mypy_cache/
+
+# Docs
+docs/
site/
+
+# IDE / OS
+.idea/
+.vscode/
+*.DS_Store
+
+# Docker itself
+Dockerfile
+.dockerignore
+
+# CI / devcontainer
+.github/
+.devcontainer/
+
+# Misc
+*.log
+.env
+examples/
+scripts/
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..9a518d3
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,53 @@
+name: Build & Push Docker Image
+
+on:
+ push:
+ branches: ["main"]
+ release:
+ types: [published]
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+ build-and-push:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to the Container registry
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Extract metadata (tags, labels) for Docker
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ tags: |
+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
+ type=sha,prefix=sha-,enable=${{ github.ref == 'refs/heads/main' }}
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ - name: Build and push Docker image
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: true
+ platforms: linux/amd64,linux/arm64
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..211ad82
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,35 @@
+# Stage 1: dependency resolver
+FROM python:3.12-slim AS builder
+
+COPY --from=ghcr.io/astral-sh/uv:0.6.0 /uv /bin/uv
+
+WORKDIR /app
+
+COPY pyproject.toml uv.lock README.md ./
+COPY fli/ ./fli/
+
+RUN uv sync --frozen --no-dev --no-cache
+
+
+# Stage 2: minimal runtime
+FROM python:3.12-slim AS runtime
+
+WORKDIR /app
+
+# Copy only the installed venv and source from the builder
+COPY --from=builder /app/.venv /app/.venv
+COPY --from=builder /app/fli /app/fli
+
+ENV PATH="/app/.venv/bin:$PATH"
+ENV VIRTUAL_ENV="/app/.venv"
+ENV PYTHONUNBUFFERED=1
+ENV HOST="0.0.0.0"
+ENV PORT="8000"
+
+EXPOSE 8000
+
+# Run as non-root
+RUN useradd --no-create-home --shell /bin/false appuser
+USER appuser
+
+CMD ["fli-mcp-http"]
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..0e61f6e
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,15 @@
+services:
+ fli-mcp:
+ image: ghcr.io/punitarani/fli:latest
+ ports:
+ - "8000:8000"
+ environment:
+ HOST: "0.0.0.0"
+ PORT: "8000"
+ restart: unless-stopped
+ healthcheck:
+ test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s