-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 866 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 866 Bytes
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
###################### Build stage
FROM python:3.13-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock README.md ./
# Copy source code and build wheel
COPY src/ ./src/
# Install dependencies
RUN uv sync --frozen --no-dev
RUN uv build
###################### Runtime stage
FROM python:3.13-slim
EXPOSE 8000
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /app/dist/*.whl ./
# Install the wheel
RUN python -m pip install --no-cache-dir *.whl && rm *.whl
# Create non-root user
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["uvicorn", "mcp_sl.server:app", "--host", "0.0.0.0", "--port", "8000", "--timeout-graceful-shutdown", "5"]