ARG III_VERSION=0.11.2 FROM iiidev/iii:${III_VERSION} AS iii-image FROM node:22-slim ARG AGENTMEMORY_VERSION=0.9.12 ARG III_VERSION=0.11.2 ARG III_SDK_VERSION=0.11.2 RUN apt-get update \ && apt-get install -y --no-install-recommends openssl ca-certificates tini gosu curl \ && rm -rf /var/lib/apt/lists/* COPY --from=iii-image /app/iii /usr/local/bin/iii # Install agentmemory into a dedicated prefix so the local package.json's # `overrides` field pins iii-sdk down to match the engine (agentmemory's # caret range `^0.11.2` otherwise resolves to 0.11.6, the version that # requires the new sandbox-everything worker model the agentmemory CLI # is not refactored for yet). `npm install -g` ignores overrides, hence # the local prefix. WORKDIR /opt/agentmemory RUN printf '{"name":"agentmemory-deploy","version":"1.0.0","private":true,"overrides":{"iii-sdk":"%s"}}\n' "${III_SDK_VERSION}" > package.json \ && npm install "@agentmemory/agentmemory@${AGENTMEMORY_VERSION}" --omit=optional --no-fund --no-audit \ && ln -s /opt/agentmemory/node_modules/.bin/agentmemory /usr/local/bin/agentmemory ENV AGENTMEMORY_III_VERSION=${III_VERSION} \ TINI_SUBREAPER=1 COPY --chmod=0755 entrypoint.sh /usr/local/bin/agentmemory-entrypoint.sh EXPOSE 3111 ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/agentmemory-entrypoint.sh"]