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

Optimize Java-Tron Docker image and its building process #6134

Open
3for opened this issue Dec 31, 2024 · 10 comments
Open

Optimize Java-Tron Docker image and its building process #6134

3for opened this issue Dec 31, 2024 · 10 comments

Comments

@3for
Copy link

3for commented Dec 31, 2024

Background

Docker streamlines the development lifecycle by allowing developers to work in standardized environments using local containers which provide your applications and services. Containers are great for continuous integration and continuous delivery (CI/CD) workflows.
Although TRON supports quickstart with docker already, the following issues exist:

    1. It currently uses patched centos7 as the base image. There’s no official support for centos7 image anymore.
    1. Java-TRON image size is almost 500MB, while ethereum/client-go image is less than 100MB, hyperledger/besu image is less than 300MB, so it takes a little longer to download Java-TRON image.
    1. There’s no test for Java-TRON image.
    1. There’s no CI/CD for docker image.

Rationale

In order to reduce docker image size, add tests for docker images and improve docker image security, maybe it’s better to:

  • change the base image from patched centos7 to ubuntu24.
  • optimize Dockerfile instructions to reduce image size.
  • add testcase for Java-TRON image, besu selects goss tool to test.
  • support CI/CD for docker image building and testing with gradle tasks.

Scope Of Impact

This feature is for better developer experience only, it won’t affect the fullnode functionality.

Implementation

Do you have ideas regarding the implementation of this feature?

  • https://github.com/hyperledger/besu is a Java-based Ethereum client. Maybe we can get some inspiration from it to support this feature. And wonder if there’re any better references available.

Are you willing to implement this feature

  • Yes, I’d like to implement this feature with the help of the community.
@317787106
Copy link
Contributor

@3for That sounds great! Compared to Ubuntu, CentOS 8 maintains greater compatibility with the current CentOS 7. So, why not choose CentOS 8?

@3for
Copy link
Author

3for commented Dec 31, 2024

@3for That sounds great! Compared to Ubuntu, CentOS 8 maintains greater compatibility with the current CentOS 7. So, why not choose CentOS 8?

CentOS Linux 8 has reached End of Life on December 31, 2021, and the official Centos docker image support is deprecated.

@CarlChaoCarl
Copy link
Contributor

@3for
Great,These improvements will help enhance the efficiency of developers' work.
At the same time, I have two questions. Could you help answer them?

  • What is the expected size of the new image after optimization?
  • Will there be any performance degradation, and is there any specific data or references available?

@GrothenDI
Copy link

What difference is causing ethereum/client-go image to be so much smaller than java tron's ?

@3for
Copy link
Author

3for commented Jan 2, 2025

  • What is the expected size of the new image after optimization?

It's expected to be less than 300MB, just like hyperledger/besu/ (a Java-based Ethereum-client).
The size of the patched centos7:0.2 used in current java-tron docker image is almost 250MB. While the size of ubuntu24.04 used in hyperledger/besu docker image is less than 30MB. So we can gain almost 220MB from the replacement.
The expected size should be about 500-220MB=280MB.

  • Will there be any performance degradation, and is there any specific data or references available?

There should be no performance degradation, just replace the base image of 'patched Centos7' with 'Ubuntu24'. And we can bench the new docker image once finished.

@3for
Copy link
Author

3for commented Jan 2, 2025

@GrothenDI

What difference is causing ethereum/client-go image to be so much smaller than java tron's ?

Alpine used in ethereum/client-go is less than 4MB. The Go compiled file size is more compact than Java. And the Jre is another overhead.

@angrynurd
Copy link

angrynurd commented Jan 2, 2025

@3for
i have 3 simple questions for this issue:
Migration Plan:What is the detailed migration strategy and timeline for transitioning to the new base image, and how will the transition be managed to minimize disruption for current users?
Multi-Architecture Support: Will there be support for multiple architectures (such as arm64, amd64, etc.), to allow the Java-Tron Docker image to be used across different hardware platforms?
base images security: how will the image be kept up-to-date with the latest security patches?

@3for
Copy link
Author

3for commented Jan 2, 2025

@endiaoekoe

Migration Plan:What is the detailed migration strategy and timeline for transitioning to the new base image, and how will the transition be managed to minimize disruption for current users?

New docker image will be published following new Java-Tron version, old image running old Java-Tron will still work. It won't need any migration.

Multi-Architecture Support: Will there be support for multiple architectures (such as arm64, amd64, etc.), to allow the Java-Tron Docker image to be used across different hardware platforms?

We can support multi-arch docker images once our Java-Tron code supports.

base images security: how will the image be kept up-to-date with the latest security patches?

There's official docker scout tool to proactively enhance software supply chain security. Take ubuntu 24.04 as an example, there're no high vulnerabilities.
We'll update the base image version to keep secure.

@DongDongSunny
Copy link

@3for For CI/CD for docker image, any idea or plan

@3for
Copy link
Author

3for commented Jan 6, 2025

@DongDongSunny

@3for For CI/CD for docker image, any idea or plan

We can implement it with a gradle task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants