Skip to content

Feat/docker setup - #32

Merged
yash-pouranik merged 2 commits into
mainfrom
feat/docker-setup
Mar 4, 2026
Merged

Feat/docker setup#32
yash-pouranik merged 2 commits into
mainfrom
feat/docker-setup

Conversation

@yash-pouranik

@yash-pouranik yash-pouranik commented Mar 4, 2026

Copy link
Copy Markdown
Member

🐳 feat: Docker Self-Hosting Support

What's added

  • backend/Dockerfile — Node 20 Alpine, production-only deps (npm ci --omit=dev)
  • backend/.dockerignore — excludes node_modules, .env, test files
  • docker-compose.yml — spins up backend + mongo:7 + redis:7-alpine with named volumes for data persistence
  • .env.example (root) — Docker-friendly template with pre-filled MONGO_URL and REDIS_URL pointing to service names

How it works

MONGO_URL and REDIS_URL are automatically overridden inside compose to use Docker service names (mongo, redis), so no manual config is needed for the DB/cache layer. External services (Supabase, Resend) are still configured via .env.

Usage

```bash
cp .env.example .env

Fill in secrets

docker-compose up --build
```

Type of Change

  • New feature (self-hosting support, no breaking changes)

Summary by CodeRabbit

  • Chores
    • Added Docker containerization and Docker Compose configuration for backend deployment, including environment configuration template and orchestration of database and cache services.

@vercel

vercel Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ur-backend Ready Ready Preview, Comment Mar 4, 2026 9:20am

@yash-pouranik
yash-pouranik temporarily deployed to feat/docker-setup - urBackend-frankfrut PR #32 March 4, 2026 09:20 — with Render Destroyed
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces comprehensive Docker support for the application, enabling easier self-hosting and deployment. It containerizes the backend service and provides a docker-compose.yml setup to orchestrate the backend with MongoDB and Redis, along with a streamlined environment configuration for Docker environments.

Highlights

  • Docker Backend Containerization: Introduced a Dockerfile for the Node.js backend, using Node 20 Alpine and installing production-only dependencies to create a lean and efficient image.
  • Docker Compose Orchestration: Added a docker-compose.yml file to easily spin up the backend service along with MongoDB (v7) and Redis (v7-alpine), ensuring data persistence with named volumes.
  • Docker-Friendly Environment Configuration: Provided a new .env.example file at the root, pre-configured with Docker service names for MONGO_URL and REDIS_URL, simplifying setup for self-hosting without manual database URL adjustments.
Changelog
  • .env.example
    • Added a new example environment file to guide users in setting up necessary variables for Docker deployment, including pre-filled values for database and cache services.
  • backend/.dockerignore
    • Added a .dockerignore file to optimize Docker image builds by excluding irrelevant files and directories like node_modules, .env, and test files.
  • backend/Dockerfile
    • Added a Dockerfile to define the build process for the Node.js backend, specifying Node 20 Alpine as the base image and installing production dependencies.
  • docker-compose.yml
    • Added a docker-compose.yml file to define and run multi-container Docker applications, orchestrating the backend, MongoDB, and Redis services with appropriate configurations and volume mappings.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request introduces Docker containerization for the project with configuration files for building and orchestrating containerized services. A .env.example template is added for environment configuration. No application code logic changes are introduced.

Changes

Cohort / File(s) Summary
Docker Configuration
backend/Dockerfile, backend/.dockerignore, docker-compose.yml
Adds production Dockerfile using Node.js 20-alpine base, Docker build exclusion patterns, and docker-compose orchestration defining MongoDB, Redis, and backend services with port mappings and volume persistence.
Environment Template
.env.example
Provides example environment variable configuration template with descriptive comments covering server, database, authentication, Supabase, Resend email, and frontend settings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop, hop! A burrow of containers,
Where MongoDB and Redis store treasures,
Node hops in to orchestrate the dance,
Docker builds a cozy warren for each service,
Production ready, with .env as the magic key! 🔑

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/docker setup' directly relates to the main changes in the PR, which introduce Docker configuration files (Dockerfile, docker-compose.yml, .dockerignore, and .env.example) for containerizing the backend application.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/docker-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Docker support for self-hosting. However, there are significant security concerns regarding the exposure of database services. Both MongoDB and Redis are configured to expose their default ports to the host machine without any authentication, making them publicly accessible and highly insecure for production or self-hosting environments. Additionally, I've suggested running the backend container as a non-root user, pinning the Redis image version, and adding healthchecks for more reliable service startup.

Comment thread docker-compose.yml
Comment thread docker-compose.yml
Comment thread backend/Dockerfile
Comment thread docker-compose.yml
Comment thread docker-compose.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
docker-compose.yml (1)

35-37: Document Docker Compose version requirement or use short syntax for compatibility.

The long env_file syntax with required: false requires Docker Compose 2.24.0+. If you need to support older versions, use the short syntax instead. If .env should be required in your setup, remove required: false or set required: true explicitly.

For maximum compatibility
    env_file:
-     - path: .env
-       required: false
+     - .env
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.yml` around lines 35 - 37, The docker-compose.yml uses the
long env_file syntax with "required: false" which requires Compose v2.24.0+;
either document that minimum Compose version or switch to the short syntax
"env_file: - .env" for broader compatibility, or if .env must be required remove
the "required: false" or set "required: true" instead; locate the env_file block
(the "env_file" key and its "required" property) and apply one of these changes
and/or add a brief comment noting the Compose version requirement.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/Dockerfile`:
- Around line 2-18: The image currently runs as root; create and switch to a
non-root user to improve security: add a system group/user (e.g., addgroup -S
app && adduser -S app -G app or equivalent for alpine), ensure ownership of the
app directory (chown -R app:app /app) after copying files and after running npm
ci, then add a USER app directive before the CMD that runs node app.js so the
process (CMD ["node","app.js"]) runs as the non-root account; reference the
existing WORKDIR /app, RUN npm ci, COPY . ., and CMD ["node","app.js"] steps
when inserting these changes.

In `@docker-compose.yml`:
- Around line 8-9: The compose file is exposing database ports to the host
(e.g., the ports mapping '27017:27017' and the analogous '6379:6379'); remove
the host-facing port bindings and either omit the ports key or replace it with
an internal-only "expose: - 27017" / "expose: - 6379" for the MongoDB and Redis
service blocks so they remain reachable on the Docker network but not bound to
the host. Locate the services that contain the 'ports:' entries (the lines with
'27017:27017' and '6379:6379') and update them accordingly. Ensure no other
services rely on host bindings; if local host access is needed for debugging,
document using an explicit development override file that re-adds host ports.
- Line 15: The compose file currently uses the floating image tag "image:
redis:latest"; replace that with a specific, full patch Redis version (for
example "redis:7.2.2" or whatever the current stable full-version is) so
deployments are reproducible and won't unexpectedly change; update the "image:
redis:latest" entry in docker-compose.yml to the chosen pinned tag.

---

Nitpick comments:
In `@docker-compose.yml`:
- Around line 35-37: The docker-compose.yml uses the long env_file syntax with
"required: false" which requires Compose v2.24.0+; either document that minimum
Compose version or switch to the short syntax "env_file: - .env" for broader
compatibility, or if .env must be required remove the "required: false" or set
"required: true" instead; locate the env_file block (the "env_file" key and its
"required" property) and apply one of these changes and/or add a brief comment
noting the Compose version requirement.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7f6f67b-0bf3-489b-a244-de1e5ad8ae62

📥 Commits

Reviewing files that changed from the base of the PR and between 4f88fbb and b3e80bd.

📒 Files selected for processing (4)
  • .env.example
  • backend/.dockerignore
  • backend/Dockerfile
  • docker-compose.yml

Comment thread backend/Dockerfile
Comment thread docker-compose.yml
Comment thread docker-compose.yml
@yash-pouranik
yash-pouranik merged commit cc32bb6 into main Mar 4, 2026
7 checks passed
@yash-pouranik
yash-pouranik deleted the feat/docker-setup branch March 4, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant