robots.ts + metadata.robots blocks indexing.
serverActions.allowedOrigins gates cross-origin Server Action posts.
Bot + web Dockerfiles add a non-root 'app' user (uid 1000) with
chmod 700 on /data/sessions.
sendTestAction grows a per-group rate limit (3/60s).
resumeReminderRunAction + cancelReminderRunAction get a per-IP
rate limit (30/10s).
.env.example documents every required key.
packages/db/src/scripts/{set-password,create-user}.ts + thin shell
wrappers in scripts/ — first admin sets their password via
./scripts/set-password.sh admin before signing in.
37 lines
1.3 KiB
Docker
37 lines
1.3 KiB
Docker
FROM node:22-alpine AS base
|
|
RUN npm install -g pnpm@9.12.0
|
|
WORKDIR /app
|
|
|
|
FROM base AS deps
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
|
COPY apps/bot/package.json apps/bot/
|
|
COPY packages/db/package.json packages/db/
|
|
COPY packages/shared/package.json packages/shared/
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
FROM base AS build
|
|
COPY --from=deps /app/node_modules /app/node_modules
|
|
COPY --from=deps /app/apps/bot/node_modules /app/apps/bot/node_modules
|
|
COPY --from=deps /app/packages/db/node_modules /app/packages/db/node_modules
|
|
COPY --from=deps /app/packages/shared/node_modules /app/packages/shared/node_modules
|
|
COPY tsconfig.base.json turbo.json ./
|
|
COPY apps/bot apps/bot
|
|
COPY packages/db packages/db
|
|
COPY packages/shared packages/shared
|
|
RUN pnpm --filter @cmbot/shared build && pnpm --filter @cmbot/db build && pnpm --filter @cmbot/bot build
|
|
|
|
FROM base AS runtime
|
|
ENV NODE_ENV=production
|
|
COPY --from=build /app/node_modules /app/node_modules
|
|
COPY --from=build /app/apps/bot /app/apps/bot
|
|
COPY --from=build /app/packages/db /app/packages/db
|
|
COPY --from=build /app/packages/shared /app/packages/shared
|
|
RUN addgroup -g 1000 app && \
|
|
adduser -D -u 1000 -G app -s /sbin/nologin app && \
|
|
mkdir -p /data/sessions /data/media /app && \
|
|
chown -R app:app /app /data && \
|
|
chmod 700 /data/sessions
|
|
USER app
|
|
EXPOSE 8081
|
|
CMD ["node", "apps/bot/dist/index.js"]
|