molecule-ai-workspace-templ.../Dockerfile
Hongming Wang a72fe353c7
Some checks failed
CI / validate (push) Failing after 0s
fix: restore COPY/RUN lines in Dockerfile
Previous commit's regex substitution dropped `COPY requirements.txt .`
and the initial `RUN pip install --no-cache-dir -r requirements.txt`
because of a bash-heredoc escape interaction (the \1 backref was
consumed before the python regex saw it, leaving a SOH char). This
restores both lines with the conditional version-pin upgrade after.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 07:50:17 -07:00

40 lines
1.5 KiB
Docker

FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
curl gosu ca-certificates nodejs npm \
&& rm -rf /var/lib/apt/lists/*
# Install Gemini CLI
RUN npm install -g @google/gemini-cli 2>/dev/null || true
RUN useradd -u 1000 -m -s /bin/bash agent
WORKDIR /app
# RUNTIME_VERSION is forwarded from molecule-ci's reusable publish
# workflow as a docker build-arg. Cascade-triggered builds set it to
# the exact runtime version PyPI just published. Including it as an
# ARG changes the cache key for the pip install layer below — the
# fix for the cascade cache trap that bit us 5x on 2026-04-27.
ARG RUNTIME_VERSION=
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
if [ -n "${RUNTIME_VERSION}" ]; then \
pip install --no-cache-dir --upgrade "molecule-ai-workspace-runtime==${RUNTIME_VERSION}"; \
fi
COPY adapter.py .
COPY __init__.py .
# Adapter-specific executor — owned by THIS template (universal-runtime
# refactor, molecule-core task #87 / #122). Lives alongside adapter.py
# so Python's import system picks the local /app/cli_executor.py before
# any same-named module under site-packages. Once molecule-core drops
# the file from its workspace/ package, this template becomes the sole
# source of truth (codex/ollama presets in the file are dead — neither
# has a template repo today, so the file lives here only for gemini-cli).
COPY cli_executor.py .
ENV ADAPTER_MODULE=adapter
ENTRYPOINT ["molecule-runtime"]