feat: add Docker and Docker Compose support for self-hosting#149
Open
ethicalmohit wants to merge 2 commits into
Open
feat: add Docker and Docker Compose support for self-hosting#149ethicalmohit wants to merge 2 commits into
ethicalmohit wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
backend/Dockerfileandfrontend/Dockerfilefor both servicesdocker-compose.ymlat the repo root to wire them together.env.exampledocumenting the three build-time vars needed by Composeoutput: "standalone"innext.config.tsfor a smaller frontend runtime imageWhy
Makes self-hosting straightforward — the full stack can be built and started with a single command:
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 bylibreoffice-convert), compiles TypeScript and runsnode dist/index.jsfrontend/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 imagedocker-compose.yml: exposes backend on 3001, frontend on 3000; frontend depends on backend; both load env from their respective.envfiles.env.example: documents the root-level build args for Composefrontend/next.config.ts: addsoutput: "standalone"— required for the optimized Docker image, no effect on the existing Cloudflare deployment pathTesting
Built and ran locally with both containers healthy:
http://localhost:3001/healthreturns{"ok":true}http://localhost:3000serves the app