Zero icon indicating copy to clipboard operation
Zero copied to clipboard

fix: docker files for db and app

Open krakenftw opened this issue 8 months ago • 4 comments

Description

Migrated from Bun to Node.js with pnpm across Docker configurations. This change replaces Bun with pnpm for dependency management, build processes, and runtime execution in both the application and database Dockerfiles. The migration includes updating base images from oven/bun:alpine to node:22-alpine, modifying installation commands, and adjusting file copying processes to work with the pnpm workspace structure.


Type of Change

  • [x] 🐛 Bug fix (non-breaking change which fixes an issue)

Areas Affected

  • [x] Deployment/Infrastructure

Testing Done

  • [x] Manual testing performed

Checklist

  • [x] I have read the CONTRIBUTING document
  • [x] My code follows the project's style guidelines
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in complex areas
  • [x] My changes generate no new warnings
  • [x] All tests pass locally

By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.

krakenftw avatar May 28 '25 04:05 krakenftw

Walkthrough

The changes transition the Docker build and runtime environments from Bun to Node.js with pnpm as the package manager. Dockerfiles for application and database services are updated accordingly, and the docker-compose production configuration for migrations now uses pnpm instead of Bun for running database migrations.

Changes

File(s) Change Summary
docker-compose.prod.yaml Updated migrations service to use pnpm run db:migrate instead of bun run db:migrate.
docker/app/Dockerfile Switched base image from Bun to Node.js, replaced Bun with pnpm for dependency management and build steps, updated file copying, and changed user/group setup.
docker/db/Dockerfile Changed base image from Bun to Node.js, replaced Bun with pnpm for dependency installation, expanded copied files, and updated working directory.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Docker as Docker Build
    participant Node as Node.js + pnpm
    participant App as Application
    participant DB as Database

    Dev->>Docker: Build app/db images
    Docker->>Node: Use node:22-alpine base image
    Docker->>Node: Install pnpm globally
    Docker->>Node: Install dependencies with pnpm
    Docker->>App: Build application with pnpm run build
    Docker->>DB: Install and prepare server/db with pnpm

    Dev->>Docker: Run migrations service
    Docker->>Node: Use pnpm run db:migrate
    Node->>DB: Execute database migrations

Assessment against linked issues

Objective Addressed Explanation
Fix production Docker Compose setup to build and run successfully (#1083)
Correct Dockerfiles to remove references to non-existent bun.lock and fix build failures
Ensure all necessary workspace files are present and referenced correctly in Docker build context
Replace bun install commands with pnpm install to resolve missing workspace dependencies
Enable users to run docker compose -f docker-compose.prod.yaml --env-file .env up -d without errors

Possibly related PRs

  • Mail-0/Zero#443: Migrates the project from pnpm to Bun, which is the reverse of the changes in this PR, directly affecting the same tooling and workflows.
  • Mail-0/Zero#871: Introduces and modifies the multi-stage Docker image and migrations container, which are further updated in this PR to use Node.js and pnpm.

Poem

From Bun to Node, the winds have spun,
With pnpm’s hop, new builds begun.
Dockerfiles fresh, commands anew,
Migrations run with pnpm too!
A rabbit’s cheer for changes bright—
Our code now leaps with all its might.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ace53e543051d5554ab5f3036ecbefc1dcd8478a and 71f3686df9f3179e1447d3afe6a198a469b5f287.

📒 Files selected for processing (1)
  • docker/app/Dockerfile (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docker/app/Dockerfile

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 28 '25 04:05 coderabbitai[bot]

@MrgSub Any reviews here?

krakenftw avatar May 31 '25 04:05 krakenftw

Any updates on this? Your docker files not working on the main branch

SerhiiMandrykin avatar May 31 '25 09:05 SerhiiMandrykin

Merge activity

  • May 31, 4:25 PM UTC: Graphite couldn't merge this PR because it failed for an unknown reason (Stack merges are not currently supported for forked repositories. Please create a branch in the target repository in order to merge).

MrgSub avatar May 31 '25 16:05 MrgSub

@MrgSub, Why do you need AI to merge a PR? Just curious.

SerhiiMandrykin avatar Jun 02 '25 10:06 SerhiiMandrykin

@MrgSub, Why do you need AI to merge a PR? Just curious.

We use Graphite to auto-rebase and avoid conflicts, and streamline merging

MrgSub avatar Jun 10 '25 20:06 MrgSub