diff --git a/Dockerfile.prod b/Dockerfile.prod index 8e5796a28..feed831a3 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -23,7 +23,7 @@ RUN pnpm build # (Also avoids extensions/memory-core requiring unreleased clawdbot version) # Stage 2: Build checkins extension -FROM node:22-slim AS extension-builder +FROM node:22-slim AS checkins-builder RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* @@ -32,9 +32,22 @@ COPY extensions/checkins ./ RUN npm install && npm run build +# Stage 2b: Build memory-core extension +FROM node:22-slim AS memory-core-builder + +WORKDIR /build +COPY extensions/memory-core ./ + +# Add esbuild and build (skip peer deps to avoid unreleased clawdbot version) +RUN npm install --legacy-peer-deps esbuild && \ + npx esbuild index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:clawdbot --external:clawdbot/* + # Stage 3: Production image FROM node:22-bookworm-slim +# Install jq for config merging +RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/* + WORKDIR /app # Copy built clawdbot @@ -43,26 +56,32 @@ COPY --from=clawdbot-builder /app/node_modules ./node_modules COPY --from=clawdbot-builder /app/package.json ./package.json # UI not built - gateway-only deploy -# Copy the pre-built extension to staging (PVC will mount over /root/.clawdbot) -COPY --from=extension-builder /build /app/bundled-plugins/checkins +# Copy the pre-built extensions to staging (PVC will mount over /root/.clawdbot) +COPY --from=checkins-builder /build /app/bundled-plugins/checkins +COPY --from=memory-core-builder /build /app/bundled-plugins/memory-core # Copy default config COPY deploy/prod/clawdbot.json /app/clawdbot.default.json -# Install production dependencies for extension +# Install production dependencies for extensions WORKDIR /app/bundled-plugins/checkins RUN rm -rf node_modules && npm install --omit=dev # Create entrypoint script RUN echo '#!/bin/sh\n\ -if [ ! -f "/root/.clawdbot/clawdbot.json" ]; then\n\ - echo "Creating default config..."\n\ - mkdir -p /root/.clawdbot\n\ +mkdir -p /root/.clawdbot\n\ +if [ -f "/root/.clawdbot/clawdbot.json" ]; then\n\ + echo "Merging repo config with existing config..."\n\ + jq -s ".[0] * .[1]" /root/.clawdbot/clawdbot.json /app/clawdbot.default.json > /tmp/merged.json\n\ + mv /tmp/merged.json /root/.clawdbot/clawdbot.json\n\ +else\n\ + echo "Creating config from repo..."\n\ cp /app/clawdbot.default.json /root/.clawdbot/clawdbot.json\n\ fi\n\ -echo "Installing checkins plugin..."\n\ +echo "Installing plugins..."\n\ mkdir -p /root/.clawdbot/extensions\n\ cp -r /app/bundled-plugins/checkins /root/.clawdbot/extensions/\n\ +cp -r /app/bundled-plugins/memory-core /root/.clawdbot/extensions/\n\ exec node /app/dist/entry.js gateway run\n\ ' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh diff --git a/deploy/prod/clawdbot.json b/deploy/prod/clawdbot.json index 23eae9a4c..80334f360 100644 --- a/deploy/prod/clawdbot.json +++ b/deploy/prod/clawdbot.json @@ -76,12 +76,15 @@ }, "plugins": { "entries": { - "discord": { - "enabled": true - }, "checkins": { "enabled": true + }, + "memory-core": { + "enabled": true } + }, + "slots": { + "memory": "memory-core" } } }