-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (33 loc) · 1.27 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Multi-stage build for minimal final image
FROM --platform=$TARGETPLATFORM ghcr.io/astral-sh/uv:latest AS uv
FROM --platform=$TARGETPLATFORM python:3.12-slim AS builder
# Install uv for faster dependency management
COPY --from=uv /uv /usr/local/bin/uv
# Set working directory
WORKDIR /app
# Copy dependency files and README (needed for package metadata)
COPY pyproject.toml uv.lock* README.md ./
# Copy source code (needed for building the package)
COPY src/ ./src/
# Install dependencies into a virtual environment
RUN uv sync --frozen --no-dev
# Final stage - minimal runtime image
FROM --platform=$TARGETPLATFORM python:3.12-slim
# Set working directory
WORKDIR /app
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY src/ ./src/
COPY pyproject.toml ./
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Expose MCP server
# The server runs via stdio, so no port exposure needed
# Health check (optional - checks if Python and dependencies are available)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python -c "import garmin_connect_mcp; print('ok')" || exit 1
# Run the MCP server
ENTRYPOINT ["garmin-connect-mcp"]