-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.1 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
48
49
# Build stage
FROM python:3.12-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Set work directory
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN uv sync --frozen --no-install-project --no-dev
# Production stage
FROM python:3.12-slim
# Install runtime dependencies (none needed for this app)
# RUN apt-get update && apt-get install -y --no-install-recommends \
# && rm -rf /var/lib/apt/lists/*
# Copy virtual environment from builder
COPY --from=builder --chown=app:app /app/.venv /app/.venv
# Make sure we use venv
ENV PATH="/app/.venv/bin:$PATH"
# Copy application code
COPY --chown=app:app . .
# Create non-root user
RUN useradd --create-home --shell /bin/bash app
# Switch to non-root user
USER app
# Set work directory
WORKDIR /app
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8080/health')"
# Run the application
CMD ["python", "-c", "from mcp_app.main import main_http; main_http()"]