apps/appservice: framework-agnostic node:http daemon hosting @mosaicstack/appservice — Synapse transactions endpoint passthrough, internal bridge API v1 (messages/typing) with HMAC-digest timing-safe bearer tokens, 1MiB request body cap, explicit 405 inside the authenticated bridge block (no fall-through around auth), health endpoint, env config, registration YAML printer bin. docker/appservice.Dockerfile mirrors the gateway multi-stage pnpm/turbo pattern, runs as USER node with container healthcheck. 9 vitest tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
1023 B
Docker
29 lines
1023 B
Docker
FROM node:22-alpine AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
# Copy workspace manifests first for layer-cached install
|
|
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
|
|
COPY apps/appservice/package.json ./apps/appservice/
|
|
COPY packages/ ./packages/
|
|
COPY plugins/ ./plugins/
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY . .
|
|
RUN pnpm turbo run build --filter @mosaicstack/mosaic-as...
|
|
RUN pnpm --filter @mosaicstack/mosaic-as --prod deploy --legacy /deploy
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
COPY --from=builder /deploy/node_modules ./node_modules
|
|
COPY --from=builder /deploy/package.json ./package.json
|
|
COPY --from=builder /app/apps/appservice/dist ./dist
|
|
USER node
|
|
EXPOSE 8008
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=5 \
|
|
CMD ["node", "-e", "require('http').get('http://127.0.0.1:8008/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
|
CMD ["node", "dist/main.js"]
|