Skip to content

Commit 7614e23

Browse files
carlkesselmanclaude
andcommitted
Add dev Docker build and update deriva-ml source to GitHub
- Add Dockerfile.dev and docker-compose.dev.yaml for building from local sources (deriva-py, deriva-ml, deriva-mcp) using uv overrides - Update uv.lock to use deriva-ml from GitHub (includes create_ml_workspace) - Add deriva-ml uv source pointing to GitHub repo Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 861734c commit 7614e23

File tree

4 files changed

+98
-4
lines changed

4 files changed

+98
-4
lines changed

Dockerfile.dev

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Development Dockerfile for Deriva MCP Server
2+
# Build context must be the parent directory containing deriva-mcp, deriva-ml, and deriva-py
3+
#
4+
# Usage:
5+
# docker build -f deriva-mcp/Dockerfile.dev -t deriva-mcp:dev /Users/carl/GitHub
6+
7+
FROM python:3.12-slim AS builder
8+
9+
WORKDIR /app
10+
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
git \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
RUN pip install --no-cache-dir uv
16+
17+
# Copy local sources from parent build context
18+
COPY deriva-py /app/deriva-py
19+
COPY deriva-ml /app/deriva-ml
20+
COPY deriva-mcp/pyproject.toml deriva-mcp/README.md /app/deriva-mcp/
21+
COPY deriva-mcp/src /app/deriva-mcp/src
22+
23+
# Create virtual environment
24+
RUN uv venv /opt/venv
25+
ENV PATH="/opt/venv/bin:$PATH"
26+
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DERIVA_MCP="0.0.0.dev0"
27+
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DERIVA_ML="0.0.0.dev0"
28+
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DERIVA="0.0.0.dev0"
29+
30+
# Use uv with overrides to resolve local vs git URL conflicts.
31+
# Install all three local packages, overriding their git source references
32+
# to point to the local paths instead.
33+
RUN uv pip install --no-cache \
34+
--override /dev/stdin \
35+
/app/deriva-py /app/deriva-ml /app/deriva-mcp \
36+
<<'OVERRIDES'
37+
deriva @ file:///app/deriva-py
38+
deriva-ml @ file:///app/deriva-ml
39+
OVERRIDES
40+
41+
# Runtime stage
42+
FROM python:3.12-slim
43+
44+
WORKDIR /app
45+
46+
RUN apt-get update && apt-get install -y --no-install-recommends \
47+
git \
48+
ca-certificates \
49+
curl \
50+
&& rm -rf /var/lib/apt/lists/*
51+
52+
COPY --from=builder /opt/venv /opt/venv
53+
ENV PATH="/opt/venv/bin:$PATH"
54+
55+
# Same entrypoint as production Dockerfile
56+
RUN printf '#!/bin/sh\n\
57+
cp /etc/hosts /tmp/hosts.tmp\n\
58+
sed -e "s/^127\\.0\\.0\\.1[[:space:]]\\+localhost/#&/" -e "s/^::1[[:space:]]\\+localhost/#&/" /tmp/hosts.tmp > /etc/hosts 2>/dev/null || true\n\
59+
rm -f /tmp/hosts.tmp\n\
60+
: "${REQUESTS_CA_BUNDLE:=$HOME/.deriva/allCAbundle-with-local.pem}"\n\
61+
export REQUESTS_CA_BUNDLE\n\
62+
exec "$@"\n\
63+
' > /entrypoint.sh && chmod +x /entrypoint.sh
64+
65+
ENV DERIVA_MCP_WORKFLOW_NAME="Deriva MCP Server (dev)"
66+
ENV DERIVA_MCP_WORKFLOW_TYPE="Deriva MCP"
67+
ENV DERIVA_MCP_IN_DOCKER="true"
68+
ENV DERIVA_MCP_TASK_STATE_PATH="/app/data/task_state.json"
69+
ENV DERIVA_MCP_TASK_RETENTION_HOURS="168"
70+
ENV DERIVA_MCP_TASK_SYNC_INTERVAL="5"
71+
ENV DERIVA_MCP_SSE_KEEPALIVE="30"
72+
73+
RUN mkdir -p /app/data && chmod 755 /app/data
74+
75+
EXPOSE 8000
76+
77+
ENTRYPOINT ["/entrypoint.sh"]
78+
CMD ["deriva-mcp"]

docker-compose.dev.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Development override for docker-compose.mcp.yaml
2+
# Builds from local source with local deriva-ml and deriva-py
3+
#
4+
# Usage:
5+
# docker compose -f docker-compose.mcp.yaml -f docker-compose.dev.yaml build --no-cache
6+
# docker compose -f docker-compose.mcp.yaml -f docker-compose.dev.yaml up -d
7+
8+
services:
9+
deriva-mcp:
10+
build:
11+
context: ..
12+
dockerfile: deriva-mcp/Dockerfile.dev
13+
image: deriva-mcp:dev
14+
extra_hosts:
15+
- "localhost:172.28.3.250"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ build-backend = "setuptools.build_meta"
5151

5252
[tool.uv.sources]
5353
deriva = {git = "https://github.com/informatics-isi-edu/deriva-py", branch = "2.0-dev"}
54+
deriva-ml = {git = "https://github.com/informatics-isi-edu/deriva-ml.git"}
5455

5556
[tool.setuptools.packages.find]
5657
where = ["src"]

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)