feat: add Docker and Docker Compose support for self-hosting

🟢 open · #149 · Open-Legal-Products/mike ← ethicalmohit/mike · opened 2mo ago by ethicalmohit · +112-1 across 6 files · ↗ on GitHub

From the PR description

Summary

  • Adds backend/Dockerfile and frontend/Dockerfile for both services
  • Adds docker-compose.yml at the repo root to wire them together
  • Adds .env.example documenting the three build-time vars needed by Compose
  • Sets output: "standalone" in next.config.ts for a smaller frontend runtime image

Why

Makes self-hosting straightforward - the full stack can be built and started with a single command:

docker compose up --build

No platform-specific tooling required. The deployment still uses the existing Supabase and Cloudflare R2 infrastructure - this is purely about packaging and running the app, not replacing any services.

Changes

  • backend/Dockerfile: multi-stage build; installs LibreOffice in the runner stage (required by libreoffice-convert), compiles TypeScript and runs node dist/index.js
  • frontend/Dockerfile: multi-stage build; NEXT_PUBLIC_* vars passed as build args (baked in at build time by Next.js), copies only the standalone output for a minimal image
  • docker-compose.yml: exposes backend on 3001, frontend on 3000; frontend depends on backend; both load env from their respective .env files
  • .env.example: documents the root-level build args for Compose
  • frontend/next.config.ts: adds output: "standalone" - required for the optimized Docker image, no effect on the existing Cloudflare deployment path

Testing

Built and ran locally with both containers healthy:

  • Backend: http://localhost:3001/health returns {"ok":true}
  • Frontend: http://localhost:3000 serves the app

Our analysis

Add Docker packaging and Compose for one-command self-hosting — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-149.md from inside the repo you want the changes in.

⬇ Download capture-pull-149.md