Skip to content

Update docker images and build images #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thesujai
Copy link
Contributor

@thesujai thesujai commented May 15, 2025

Linked Issue(s)

Related to #619 (comment)

The above comment mentioned about buster being depricated, so this PR attempts to update it

Further comments

  1. Updated The buster images to bookworm
  2. Updated postgres from 14 to 15(No breaking changes observed)
  3. Updated command to install dbmate based on system architecture instead of using amd64 in general

Summary by CodeRabbit

  • Chores
    • Updated backend and database Docker images to use newer Debian Bookworm base images.
    • Upgraded PostgreSQL version from 14 to 15 in the database container.
    • Enhanced database migration tool compatibility by dynamically selecting the appropriate binary for the system architecture.

Copy link

coderabbitai bot commented May 15, 2025

Walkthrough

The updates modify Dockerfiles for both the backend and database components. The backend's base image changes to python:3.9-slim-bookworm, while the database Dockerfile updates to Debian Bookworm, upgrades PostgreSQL from version 14 to 15, and adjusts the dbmate installation to be architecture-aware.

Changes

File(s) Change Summary
Dockerfile, Dockerfile.prebuilt Changed base image from python:3.9-slim to python:3.9-slim-bookworm.
database-docker/Dockerfile Updated base image to Debian Bookworm, upgraded PostgreSQL from 14 to 15, and made dbmate installation arch-aware.

Poem

A Docker hop, a version leap,
Bookworm now in backend's keep.
PostgreSQL climbs up one floor,
And dbmate’s smarter than before.
With every build, we bound ahead—
The future’s bright, the past is shed!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9edfda0 and 2f084e9.

📒 Files selected for processing (3)
  • Dockerfile (2 hunks)
  • Dockerfile.prebuilt (1 hunks)
  • database-docker/Dockerfile (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Dockerfile.prebuilt
🚧 Files skipped from review as they are similar to previous changes (2)
  • Dockerfile
  • database-docker/Dockerfile
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: All file linting

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
Dockerfile (1)

59-69: 🛠️ Refactor suggestion

Reduce image size by removing build dependencies.
You install gcc, build-essential, and libpq-dev in the final image, but they are only needed for building your Python dependencies and Node modules. Consider removing these packages after building, or better yet, move all build-related steps into a dedicated build stage (multi-stage build) to keep the final image lean.

Proposed diff snippet:

 RUN apt-get update && \
-    apt-get install -y --no-install-recommends \
+    apt-get install -y --no-install-recommends build-deps \
         cron \
         postgresql \
         redis-server \
@@
     && yarn install --frozen-lockfile --network-timeout 1000000 && yarn build \
-    && rm -rf ./artifacts \
+    && rm -rf ./artifacts \
+   # remove build dependencies
+    && apt-get purge -y build-deps \
+    && apt-get autoremove -y \
     && cd /app/ \
     && tar cfz web-server.tar.gz ./web-server \
🧹 Nitpick comments (5)
Dockerfile (2)

76-79: Confirm PostgreSQL data directory paths.
You're appending Postgres configs under /etc/postgresql/15/main/. In this image you install the postgresql meta-package (Bookworm defaults to v15), so this path exists. However, if the default ever moves, these hardcoded paths will break. Consider pinning postgresql-15 explicitly or templating the version.


80-89: Unify dbmate architecture detection.
In the backend Dockerfile, you branch on uname -m for each arch. You can simplify by using dpkg --print-architecture (as in the database image) to fetch amd64, arm64, etc., and use a single URL template. This reduces duplication and supports all Debian-supported arches.

Example:

- if [ "$(uname -m)" = "x86_64" ]; then \
-    ARCH=amd64; \
- elif [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then \
-    ARCH=arm64; \
- else \
-   echo "Unsupported architecture: $(uname -m)"; exit 1; \
- fi && \
- curl -fsSL -o /usr/local/bin/dbmate \
-   https://github.com/amacneil/dbmate/releases/download/v1.16.0/dbmate-linux-${ARCH}; \
+ ARCH=$(dpkg --print-architecture) && \
+ curl -fsSL -o /usr/local/bin/dbmate \
+   https://github.com/amacneil/dbmate/releases/download/v1.16.0/dbmate-linux-${ARCH} && \
database-docker/Dockerfile (3)

4-4: Lock PostgreSQL repository to Bookworm PGDG.
You updated the PGDG source to bookworm-pgdg, which is correct. Ensure that the GPG key you add corresponds to this repository; you've added it via apt-key, which is deprecated in newer Debian versions.

Consider using:

RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
    | gpg --dearmor > /usr/share/keyrings/postgresql-archive-keyring.gpg && \
    echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] \
      http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" \
      > /etc/apt/sources.list.d/pgdg.list

8-10: Remove duplicate key import commands.
You're adding the same PostgreSQL GPG key twice (via curl and wget). One import is sufficient and will speed up the build.

- RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
- RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
+ RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

13-15: Use dpkg --print-architecture for dbmate.
Great enhancement to dynamically fetch the correct dbmate binary. As a refinement, add a check to fail early if the URL for the architecture is unavailable.

Example:

RUN ARCH=$(dpkg --print-architecture) && \
    URL="https://github.com/amacneil/dbmate/releases/download/v1.16.0/dbmate-linux-${ARCH}" && \
    curl --fail --location -o /usr/local/bin/dbmate "$URL" && \
    chmod +x /usr/local/bin/dbmate
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between ef856e6 and 9edfda0.

📒 Files selected for processing (2)
  • Dockerfile (2 hunks)
  • database-docker/Dockerfile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: All file linting
🔇 Additional comments (5)
Dockerfile (2)

14-14: Update base image to Bookworm for backend-build.
The python:3.9-slim-bookworm image replaces the previous Debian slim release, which keeps the OS up-to-date. Ensure compatibility of installed packages (e.g., libpq-dev) with Bookworm.


59-117:

✅ Verification successful

Validate start.sh extraction logic.
Your final RUN step tars /opt/venv and /app/web-server and then removes their contents, relying on setup_utils/start.sh (CMD) to extract them at container start. Please ensure that start.sh correctly unpacks these tarballs before launching services; otherwise, the application environment will be missing critical files.

To verify, search for extraction commands in start.sh:


🏁 Script executed:

#!/bin/bash
rg -n "tar -xzf" -- app/setup_utils/start.sh

Length of output: 111


🏁 Script executed:

#!/bin/bash
set -e

# 1. Locate any start.sh scripts in the repo
find . -type f -name "start.sh"

# 2. Confirm which startup script the Dockerfile actually invokes
rg -n '^CMD' -- Dockerfile

Length of output: 149


🏁 Script executed:

#!/bin/bash
set -e

# Display the contents of the startup script to verify extraction logic
echo "----- setup_utils/start.sh -----"
sed -n '1,200p' setup_utils/start.sh

# Highlight any tar commands within the script
echo "----- Tar commands in start.sh -----"
grep -n "tar" setup_utils/start.sh || echo "No tar commands found"

Length of output: 1904


Extraction logic in start.sh is correctly implemented.
We’ve confirmed that setup_utils/start.sh checks for /opt/venv.tar.gz and /app/web-server.tar.gz, extracts each with tar xzf … --strip-components=2 into the proper directory, and then removes the tarball before starting Supervisor. No further changes are needed.

database-docker/Dockerfile (3)

1-4: Upgrade base image to Debian Bookworm.
Switching FROM debian:bookworm ensures you’re on the non-deprecated Bookworm release. Confirm that any Debian-specific package names and repository URLs in this file match Bookworm conventions.


11-12: Explicitly install postgresql-15.
Installing postgresql-15 directly locks the version and aligns with your config paths. This avoids ambiguity if the default postgresql meta-package ever moves to another version.


20-20: Update PATH to include PostgreSQL 15 binaries.
Updating ENV PATH to /usr/lib/postgresql/15/bin:$PATH exposes the correct Postgres tools. Ensure no older Postgres binaries remain in the image.

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