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

🛠️ Refactor suggestion #102

Open
doridoridoriand opened this issue Oct 26, 2024 · 0 comments
Open

🛠️ Refactor suggestion #102

doridoridoriand opened this issue Oct 26, 2024 · 0 comments

Comments

@doridoridoriand
Copy link
Owner

          _:hammer_and_wrench: 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.

    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/*

Originally posted by @coderabbitai[bot] in #101 (comment)

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

No branches or pull requests

1 participant