2단계 배포 파일: Dockerfile·compose(2974, 메모리 1GB, 쿠키 읽기 전용)·NPMplus 보안 헤더(유튜브 플레이어 허용, noindex)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-18 19:46:31 +09:00
parent 391bbe69e5
commit 992621e70a
5 changed files with 86 additions and 0 deletions

33
deploy/Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
# Multi-stage build: install → build web → slim runtime (same layout as joke-app, docs/09)
FROM oven/bun:1.3 AS build
WORKDIR /app
COPY package.json bun.lock bunfig.toml tsconfig.base.json ./
COPY packages ./packages
COPY apps ./apps
RUN bun install --frozen-lockfile
RUN cd apps/web && bunx vite build
# Production-only dependencies (no vite/typescript/playwright in the runtime image).
FROM oven/bun:1.3 AS deps
WORKDIR /app
COPY package.json bun.lock bunfig.toml ./
COPY packages/shared/package.json packages/shared/
COPY apps/server/package.json apps/server/
COPY apps/web/package.json apps/web/
RUN bun install --frozen-lockfile --production --filter '@mq/server'
FROM oven/bun:1.3-slim
WORKDIR /app
ENV NODE_ENV=production PORT=3000 DB_PATH=/data/app.db TRUST_PROXY=1
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/packages ./packages
COPY --from=build /app/apps/server ./apps/server
COPY --from=build /app/apps/web/dist ./apps/web/dist
RUN mkdir -p /data && chown bun:bun /data
USER bun
VOLUME ["/data"]
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD bun -e "fetch('http://localhost:3000/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
STOPSIGNAL SIGTERM
CMD ["bun", "apps/server/src/index.ts"]