mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-04 02:29:55 +08:00
* feat(deploy): add a local Docker Compose deployment Add deploy/ with a Dockerfile, a Compose file and a guide. The image is built from the checkout and carries Node.js 26.11.1, Chromium, FFmpeg/ffprobe and CJK fonts. Projects and exports live in a named volume at MOTION_DATA_DIR=/data. Add MOTION_BIND_HOST so the server can listen on an address other than loopback. The default stays 127.0.0.1. The image sets 0.0.0.0 and Compose publishes the port on the host's 127.0.0.1 only. The Host and Origin checks in handler() are unchanged, so this adds no remote access. Agents connect with `docker exec -i openmotion node --experimental-strip-types mcp.ts`, which reuses the running service. Known limit: the Studio's web browser tab cannot start Chromium with its sandbox in an unprivileged container. Preview and export are unaffected. * docs(deploy): record the x86_64 container validation * fix(deploy): accept only loopback or wildcard bind addresses MOTION_BIND_HOST accepted any IP address. With a specific interface address the readiness probe and the URLs returned to Agents still used 127.0.0.1, so startup timed out and handoffs pointed at an address nothing listened on. Accept 127.0.0.1, 0.0.0.0 and :: only. Correct the access description in the deployment guide and the change record: publishing the port on the host's loopback address is the boundary. The Host and Origin checks protect a local browser from other websites and are not authentication. * fix(deploy): keep MCP connection commands inside the Docker workspace * fix(deploy): preserve primary Skill onboarding for Docker connections * fix(deploy): accept Docker discovery in Studio connection consumers * test(studio): isolate page cleanup from tracking retries --------- Co-authored-by: lefarcen <935902669@qq.com>
42 lines
1.7 KiB
Docker
42 lines
1.7 KiB
Docker
# Node version follows scripts/runtime-lock.json and CI.
|
|
ARG NODE_VERSION=26.11.1
|
|
|
|
# Build stage: full dependencies, then the Studio bundle and generated UI.
|
|
FROM node:${NODE_VERSION}-bookworm-slim AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
COPY . .
|
|
RUN npm run build:studio
|
|
|
|
# Runtime stage: production dependencies, system Chromium, FFmpeg and fonts.
|
|
FROM node:${NODE_VERSION}-bookworm-slim AS runtime
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ca-certificates chromium ffmpeg fonts-noto-cjk fonts-noto-color-emoji tini \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev --no-audit --no-fund && npm cache clean --force
|
|
COPY . .
|
|
COPY --from=build /app/studio/build ./studio/build
|
|
COPY --from=build /app/web/inline-video.html ./web/inline-video.html
|
|
COPY --from=build /app/mcp-ui/template-recommendations/build ./mcp-ui/template-recommendations/build
|
|
|
|
# The server listens on every container interface so Compose can publish the
|
|
# port; Compose publishes it on the host's loopback address only.
|
|
ENV PORT=4173 \
|
|
MOTION_BIND_HOST=0.0.0.0 \
|
|
MOTION_DATA_DIR=/data \
|
|
HYPERFRAMES_BROWSER_PATH=/usr/bin/chromium \
|
|
HYPERFRAMES_FFMPEG_PATH=/usr/bin/ffmpeg \
|
|
HYPERFRAMES_FFPROBE_PATH=/usr/bin/ffprobe
|
|
RUN mkdir -p /data && chown node:node /data
|
|
USER node
|
|
VOLUME /data
|
|
EXPOSE 4173
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
|
CMD node -e "fetch('http://127.0.0.1:'+process.env.PORT+'/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
ENTRYPOINT ["tini", "--"]
|
|
CMD ["node", "--experimental-strip-types", "server.ts"]
|