Skip to content
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

Update Ruby versions #101

Merged
merged 1 commit into from
Oct 26, 2024
Merged

Update Ruby versions #101

merged 1 commit into from
Oct 26, 2024

Conversation

doridoridoriand
Copy link
Owner

@doridoridoriand doridoridoriand commented Oct 26, 2024

Summary by CodeRabbit

  • New Features

    • Updated Ruby installation to version 3.3.4 across multiple Ubuntu Docker images (focal, jammy, lunar, noble, rolling).
  • Bug Fixes

    • Corrected download URLs and directory names for the new Ruby version to ensure proper installation.

Copy link
Contributor

coderabbitai bot commented Oct 26, 2024

Walkthrough

The pull request updates multiple Dockerfiles for various Ubuntu images to install Ruby version 3.3.4 instead of previous versions (3.2.2 or 3.3.0). Each Dockerfile has been modified to change the download URL and directory names to reflect the new Ruby version. The overall installation process and other commands remain unchanged across all affected Dockerfiles.

Changes

File Path Change Summary
lifeboat/ubuntu/Dockerfile.focal Updated Ruby installation from version 3.2.2 to 3.3.4, modified download URL and directory name.
lifeboat/ubuntu/Dockerfile.jammy Updated Ruby installation from version 3.2.2 to 3.3.4, modified download URL and directory name.
lifeboat/ubuntu/Dockerfile.lunar Updated Ruby installation from version 3.2.2 to 3.3.4, modified download URL and directory name.
lifeboat/ubuntu/Dockerfile.noble Updated Ruby installation from version 3.3.0 to 3.3.4, modified download URL and directory name.
lifeboat/ubuntu/Dockerfile.rolling Updated Ruby installation from version 3.2.2 to 3.3.4, modified download URL and directory name.

Possibly related PRs

  • Some improvements #98: This PR updates the Ruby version in the Dockerfile.noble from 3.2.2 to 3.3.0, which is related to the main PR's update of Ruby to 3.3.4, indicating a similar context of Ruby version changes in Dockerfiles.

Poem

In the Docker, we make a change,
Ruby's version, we rearrange.
From three point two to three point four,
A leap ahead, we now adore!
With every build, our code will sing,
A brighter future, Ruby brings! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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
Contributor

@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: 6

🧹 Outside diff range and nitpick comments (5)
lifeboat/ubuntu/Dockerfile.focal (1)

37-38: Consider pinning package versions for reproducible builds.

The current Dockerfile doesn't pin versions for installed packages, which could lead to inconsistent builds over time.

Consider adding version constraints to critical packages:

-    apt-get -y install build-essential gcc g++ make libtool texinfo dpkg-dev pkg-config && \
-    apt-get -y install libssl-dev zlib1g-dev libyaml-0-2 libyaml-dev && \
+    apt-get -y install build-essential=12.8ubuntu1.1 gcc=4:9.3.0-1ubuntu2 g++=4:9.3.0-1ubuntu2 \
+    make=4.2.1-1.2 libtool=2.4.6-14 texinfo=6.7.0.dfsg.2-5 dpkg-dev=1.19.7ubuntu3.2 pkg-config=0.29.1-0ubuntu4 \
+    libssl-dev=1.1.1f-1ubuntu2.20 zlib1g-dev=1:1.2.11.dfsg-2ubuntu1.5 \
+    libyaml-0-2=0.2.2-1 libyaml-dev=0.2.2-1 && \
lifeboat/ubuntu/Dockerfile.lunar (2)

37-38: Add checksum verification and cleanup build artifacts.

While the Ruby version update looks good, consider these security and optimization improvements:

  1. Verify the downloaded tarball's checksum
  2. Clean up build artifacts to reduce image size
  3. Add error handling for download and extraction

Apply this diff to implement the suggested improvements:

-    cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
-    cd ruby-3.3.4 && ./configure && make install
+    cd /tmp && rm -rf ruby && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz.sha256" && \
+    sha256sum -c ruby-3.3.4.tar.gz.sha256 && \
+    tar -zxvf ruby-3.3.4.tar.gz && \
+    cd ruby-3.3.4 && ./configure && make install && \
+    cd .. && rm -rf ruby-3.3.4* && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*

Line range hint 1-38: Consider Dockerfile optimization best practices.

To improve the Dockerfile's maintainability and reduce the image size:

  1. Consider combining apt commands to reduce layers
  2. Pin package versions for reproducible builds
  3. Use --no-install-recommends with apt-get

Here's an example of combining the first apt commands:

-RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y upgrade && DEBIAN_FRONTEND=noninteractive apt -y install build-essential && DEBIAN_FRONTEND=noninteractive apt -y install tzdata
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
+    build-essential \
+    tzdata && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
lifeboat/ubuntu/Dockerfile.noble (1)

37-38: Consider using make -j$(nproc) for faster builds.

The current make install command doesn't utilize parallel compilation. Using make -j$(nproc) can significantly speed up the build process.

-    cd ruby-3.3.4 && ./configure && make install
+    cd ruby-3.3.4 && ./configure && make -j$(nproc) install
lifeboat/ubuntu/Dockerfile.rolling (1)

37-38: Consider using Ruby version management tools.

For better version management and easier updates, consider using tools like rbenv or rvm instead of compiling from source.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6f82542 and 8182b8d.

📒 Files selected for processing (5)
  • lifeboat/ubuntu/Dockerfile.focal (1 hunks)
  • lifeboat/ubuntu/Dockerfile.jammy (1 hunks)
  • lifeboat/ubuntu/Dockerfile.lunar (1 hunks)
  • lifeboat/ubuntu/Dockerfile.noble (1 hunks)
  • lifeboat/ubuntu/Dockerfile.rolling (1 hunks)
🔇 Additional comments (2)
lifeboat/ubuntu/Dockerfile.jammy (1)

37-38: Verify Ruby installation across different architectures.

The build process should be tested on different architectures to ensure compatibility.

✅ Verification successful

Multi-architecture build support is already implemented

The repository already has robust multi-architecture build support for the Ubuntu Jammy Dockerfile through the release.multi-arch.sh script, which builds and tests the image for multiple architectures including:

  • linux/arm64
  • linux/amd64
  • linux/s390x
  • linux/ppc64le

The Ruby installation in the Dockerfile will be automatically built and tested across all these architectures through the existing CI/CD pipeline using Docker BuildX.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the Dockerfile is used in workflows for different architectures

# Test: Search for workflow files that build this Dockerfile
rg -l "Dockerfile.jammy" .github/workflows/

# Test: Search for platform-specific build configurations
rg -A 5 "platform.*linux/(amd64|arm64)" .github/workflows/

Length of output: 222


Script:

#!/bin/bash
# Let's first check if there are any workflow files in the repository
fd -e yml -e yaml

# Check for any Docker-related build configurations
rg -i "docker.*build|buildx" 

# Look for platform or architecture specific configurations
rg -i "platform|arch|amd64|arm64"

Length of output: 32045

lifeboat/ubuntu/Dockerfile.noble (1)

37-38: LGTM on Ruby version update to 3.3.4.

The update uses the correct download URL from the official Ruby source.

Comment on lines +37 to +38
cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 26, 2024

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using multi-stage builds to reduce image size.

The current build process includes development tools and temporary files in the final image, increasing its size unnecessarily.

Consider using a multi-stage build:

FROM ubuntu:focal AS builder

ENV TZ=Asia/Tokyo
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y install \
    build-essential gcc g++ make libtool texinfo dpkg-dev pkg-config \
    libssl-dev zlib1g-dev libyaml-0-2 libyaml-dev wget

RUN cd /tmp && \
    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
    tar -zxvf ruby-3.3.4.tar.gz && \
    cd ruby-3.3.4 && \
    ./configure --prefix=/usr/local && \
    make install

FROM ubuntu:focal
ENV TZ=Asia/Tokyo
COPY --from=builder /usr/local /usr/local

# Rest of your package installations...

⚠️ Potential issue

Add checksum verification for Ruby source.

While updating to Ruby 3.3.4 is good, it's recommended to verify the integrity of the downloaded tarball.

Apply this diff to add checksum verification:

-    cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
-    cd ruby-3.3.4 && ./configure && make install
+    cd /tmp && rm -rf ruby && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz.sha256" && \
+    echo "$(cat ruby-3.3.4.tar.gz.sha256) ruby-3.3.4.tar.gz" | sha256sum --check && \
+    tar -zxvf ruby-3.3.4.tar.gz && \
+    cd ruby-3.3.4 && ./configure && make install && \
+    cd /tmp && rm -rf ruby-3.3.4* && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install
cd /tmp && rm -rf ruby && \
wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz.sha256" && \
echo "$(cat ruby-3.3.4.tar.gz.sha256) ruby-3.3.4.tar.gz" | sha256sum --check && \
tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install && \
cd /tmp && rm -rf ruby-3.3.4* && \
apt-get clean && rm -rf /var/lib/apt/lists/*

Copy link
Owner Author

Choose a reason for hiding this comment

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

Issue化して別途対応とします

Copy link
Contributor

Choose a reason for hiding this comment

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

@doridoridoriand、承知しました。別途Issueを作成されるとのことですね。もしよろしければ、Issueの作成をお手伝いしましょうか?

(._.)

Copy link
Owner Author

Choose a reason for hiding this comment

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

@coderabbitai Issueの作成お願いします

Copy link
Contributor

Choose a reason for hiding this comment

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

@doridoridoriand、Issueを作成いたしました!以下のリンクからご確認ください。

#103

ご確認よろしくお願いいたします。(^_^)

🔗 Analysis chain

@doridoridoriand、Issueを作成いたしますね。(^_^)

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
gh issue create \
  --title "Add checksum verification for Ruby source in Dockerfile" \
  --body "As requested by @doridoridoriand in [PR #101](/~https://github.com/doridoridoriand/containers/pull/101) [comment](/~https://github.com/doridoridoriand/containers/pull/101#discussion_r1817698939), we should add checksum verification for the Ruby source tarball in the Dockerfile to improve security." \
  --assignee doridoridoriand

Length of output: 471

Copy link
Owner Author

Choose a reason for hiding this comment

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

ありがとうございます

Copy link
Contributor

Choose a reason for hiding this comment

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

@doridoridoriand、ありがとうございます!お役に立てて嬉しいです。

/(=^・^=)\

lifeboat/ubuntu/Dockerfile.jammy Show resolved Hide resolved
Comment on lines +37 to +38
cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding checksum verification for security.

To ensure the integrity of the downloaded Ruby source, consider adding checksum verification.

-    cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
-    cd ruby-3.3.4 && ./configure && make install
+    cd /tmp && rm -rf ruby && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
+    wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz.sha256" && \
+    echo "$(cat ruby-3.3.4.tar.gz.sha256) ruby-3.3.4.tar.gz" | sha256sum --check && \
+    tar -zxvf ruby-3.3.4.tar.gz && \
+    cd ruby-3.3.4 && ./configure && make install && \
+    cd /tmp && rm -rf ruby-3.3.4* && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd /tmp && rm -rf ruby && wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install
cd /tmp && rm -rf ruby && \
wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz" && \
wget "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz.sha256" && \
echo "$(cat ruby-3.3.4.tar.gz.sha256) ruby-3.3.4.tar.gz" | sha256sum --check && \
tar -zxvf ruby-3.3.4.tar.gz && \
cd ruby-3.3.4 && ./configure && make install && \
cd /tmp && rm -rf ruby-3.3.4* && \
apt-get clean && rm -rf /var/lib/apt/lists/*

lifeboat/ubuntu/Dockerfile.rolling Show resolved Hide resolved
@doridoridoriand doridoridoriand merged commit 1f222ad into master Oct 26, 2024
1 check passed
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