-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (43 loc) · 2.05 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (43 loc) · 2.05 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
50
51
52
53
54
55
56
57
58
59
60
61
ARG ORFS_VERSION=26Q1-534-g510137693
ARG UV_VERSION=0.10.9
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv
# Stage 1: builder - installs deps, discarded from final image.
# Both stages share openroad/orfs because OpenROAD binaries are needed at runtime.
FROM openroad/orfs:${ORFS_VERSION} AS builder
COPY --from=uv /uv /usr/local/bin/uv
ENV UV_PYTHON_INSTALL_DIR=/opt/python
WORKDIR /app
# Manifests first — dependency layer is cached independently of source changes.
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
# --no-editable installs into site-packages; source tree not needed at runtime.
COPY src/ ./src/
COPY README.md ./
RUN uv sync --frozen --no-dev --no-editable
# Stage 2: runtime
# Re-declare without defaults — values are inherited from the global ARGs above.
ARG ORFS_VERSION
FROM openroad/orfs:${ORFS_VERSION} AS runtime
RUN useradd --create-home --shell /bin/bash --uid 1000 --no-log-init appuser
WORKDIR /app
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
COPY --from=builder --chown=appuser:appuser /opt/python /opt/python
LABEL io.modelcontextprotocol.server.name="io.github.luarss/openroad-mcp"
USER appuser
ENV PATH="/app/.venv/bin:/OpenROAD-flow-scripts/tools/install/OpenROAD/bin:/OpenROAD-flow-scripts/tools/install/yosys/bin:$PATH" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
ORFS_FLOW_PATH=/OpenROAD-flow-scripts/flow
# Verify non-editable install, console script, and ORFS path are all functional.
RUN /app/.venv/bin/python -c "import openroad_mcp; print(openroad_mcp.__file__)" && \
openroad-mcp --help > /dev/null && \
test -d "${ORFS_FLOW_PATH}" || (echo "ERROR: ORFS_FLOW_PATH=${ORFS_FLOW_PATH} not found" && exit 1)
ENTRYPOINT ["openroad-mcp"]
# Stage 3: test — pinned ORFS version + uv inherited from builder
FROM builder AS test
COPY tests/ ./tests/
RUN uv sync --frozen --all-extras
ENV PYTHONPATH=/app/src
ENV PATH="/app/.venv/bin:/OpenROAD-flow-scripts/tools/install/OpenROAD/bin:/OpenROAD-flow-scripts/tools/install/yosys/bin:$PATH"
USER root
CMD ["bash"]