Skip to content

Commit ee1cc54

Browse files
authored
Merge pull request modelcontextprotocol#27 from jkoelker/jk/technicals
feat(container): enable ta in container build
2 parents 236a42f + 078149a commit ee1cc54

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

Containerfile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# syntax=docker/dockerfile:1.7
22

3+
FROM ghcr.io/astral-sh/uv:python3.12-trixie-slim AS uv-tools
4+
35
FROM python:3.12-slim AS builder
46

57
ARG DEBIAN_FRONTEND=noninteractive
@@ -9,22 +11,26 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
911
PIP_ROOT_USER_ACTION=ignore \
1012
PIP_DISABLE_PIP_VERSION_CHECK=1
1113

12-
WORKDIR /app
13-
1414
# hadolint ignore=DL3008
1515
RUN apt-get update \
1616
&& apt-get install --no-install-recommends -y build-essential \
1717
&& rm -rf /var/lib/apt/lists/*
1818

19-
COPY pyproject.toml README.md ./
19+
COPY --from=uv-tools /usr/local/bin/uv /usr/bin/
20+
21+
WORKDIR /app
22+
23+
COPY pyproject.toml README.md uv.lock ./
2024
COPY src ./src
2125

22-
# hadolint ignore=DL3013
23-
RUN pip install --no-cache-dir --upgrade pip \
24-
&& pip install --no-cache-dir build \
25-
&& python -m build --wheel --outdir /dist
26+
RUN uv build --wheel --out-dir /dist && \
27+
uv export \
28+
--format requirements-txt \
29+
--group ta \
30+
--no-emit-project \
31+
--output-file /dist/requirements.txt
2632

27-
FROM python:3.12-slim AS runtime
33+
FROM python:3.12-slim
2834

2935
ARG DEBIAN_FRONTEND=noninteractive
3036

@@ -38,11 +44,14 @@ RUN apt-get update \
3844
&& apt-get install --no-install-recommends -y ca-certificates \
3945
&& rm -rf /var/lib/apt/lists/*
4046

47+
COPY --from=uv-tools /usr/local/bin/uv /usr/bin/
48+
4149
WORKDIR /workspace
4250

4351
COPY --from=builder /dist/ /tmp/dist/
4452

45-
RUN pip install --no-cache-dir /tmp/dist/*.whl \
53+
RUN uv pip install --system --no-cache -r /tmp/dist/requirements.txt \
54+
&& uv pip install --system --no-cache /tmp/dist/*.whl \
4655
&& rm -rf /tmp/dist
4756

4857
LABEL org.opencontainers.image.title="Schwab MCP Server" \

0 commit comments

Comments
 (0)