From b43e83758c2983fb50a453aff1964076cc52c11a Mon Sep 17 00:00:00 2001 From: Matthias Hinrichs Date: Sat, 9 May 2026 01:18:53 +0200 Subject: [PATCH] feat: add Dockerfile and .dockerignore for containerized deployment --- .dockerignore | 28 ++++++++++++++++++++++++++++ Dockerfile | 30 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cfe1353 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,28 @@ +# Git and environments +.git +.gitignore +.venv +venv +env + +# Python caches +__pycache__ +*.pyc +*.pyo +*.pyd +.Python + +# Local environments and secrets +.env +.env.* + +# Linting and testing +.ruff_cache +.pytest_cache +tests/ + +# Build artifacts +dist/ +build/ +*.egg-info/ +scratch/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e1dcb65 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Use the official uv image for fast Python builds +FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder + +# Set the working directory +WORKDIR /app + +# Enable bytecode compilation +ENV UV_COMPILE_BYTECODE=1 + +# Copy the lockfile and pyproject.toml +COPY uv.lock pyproject.toml /app/ + +# Install dependencies (without the project itself) for caching +RUN uv sync --frozen --no-install-project --no-dev + +# Copy the source code and README (required by hatchling for metadata) +COPY src /app/src/ +COPY README.md /app/ + +# Install the project +RUN uv sync --frozen --no-dev + +# Make the executable available in the path +ENV PATH="/app/.venv/bin:$PATH" + +# Run the MCP server +# By default, strava-mcp uses fastmcp.run() which exposes stdio. +# If you want to run it as an SSE server, you might need to adjust the command. +# For now, we just call the main entrypoint. +ENTRYPOINT ["strava-mcp"]