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

chore: Linted Dockerfiles #12470

Closed
wants to merge 0 commits into from
Closed

chore: Linted Dockerfiles #12470

wants to merge 0 commits into from

Conversation

rotten
Copy link

@rotten rotten commented Sep 20, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This Pull Request updates the Dockerfile and Dockerfile.hdfs to pass "linting" via the hadolint Dockerfile linter.

The previous Dockerfiles had numerous issues with generally regarded "best practices" for Dockerfiles.

There is probably some optimization (of image size) and lockdown (for security issues) that can still be done, this sets the files on a solid footing for approaching that work.

Checklist

  • [ x ] I have written necessary rustdoc comments -- (updated the docker folder readme)
  • [ n/a ] I have added necessary unit tests and integration tests
  • [ n/a ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • [ no ] My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • [ n/a ] All checks passed in ./risedev check (or alias, ./risedev c)
  • [ no ] My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • [ no ] My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • [ no ] My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

  • Dockerfile cleanup

@BugenZhao BugenZhao requested a review from xxchan September 21, 2023 03:39
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! But there are some changes just merged. Can you resolve conflicts?

@rotten
Copy link
Author

rotten commented Sep 21, 2023

I've resolved the merge conflicts. I'm testing the builds on my laptop now and the pipeline is re-running.

@rotten
Copy link
Author

rotten commented Sep 21, 2023

It took a couple of tweaks, but builds with the new image work on my laptop now, and all of the pipeline tests here are passing. LMK if you have any questions!

Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

Others LGTM

docker/Dockerfile Outdated Show resolved Hide resolved
libsasl2-dev \
locales \
openjdk-11-jdk && \
rm -rf /var/lib/apt/lists/* && \
Copy link
Member

Choose a reason for hiding this comment

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

My idea is we just apt-update once in base, and avoid apt-update again in other stages, and finally delete it in the risingwave stage. How do you think?

Copy link
Author

Choose a reason for hiding this comment

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

I think it is fine as long as we don't mind having all of those other packages installed for all of the build targets.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, and you have to run update each time because I'm cleaning out the results of the update at the end of each package install to avoid the linter complaining that we are leaving interim package build artifacts in the various build targets.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I mean we don't clean here and maybe just ignore the lint.

Copy link
Author

Choose a reason for hiding this comment

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

I'd really prefer to leave each build stage "clean" if possible. Adding a bunch of linter exceptions is do-able if you really hate this. Since folks may build the container to any stage, it is better to keep each stage independent and as clean as possible if we can.

Copy link
Member

Choose a reason for hiding this comment

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

IMO this doesn't have any real benefits, except reducing a lint, and it hurts caching at the same time. Caching apt-update can be quite helpful, e.g., #7734

docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile.hdfs Outdated Show resolved Hide resolved
@wcy-fdu
Copy link
Contributor

wcy-fdu commented Sep 26, 2023

Hi @rotten , thank you for your interest and contribution to RisingWave.
We leave Dockerfile.hdfs as a standalone docker file because we only use it to manually package RisingWave images that support HDFS, and will not use it for automated testing and CI, so that your changes should ignore this file.

@rotten
Copy link
Author

rotten commented Sep 28, 2023

You could also consider adding the hdfs customizations as a different build target in the same docker file since the two files are almost identical.

@xxchan

This comment was marked as resolved.

@xxchan xxchan changed the title Linted Dockerfiles chore: Linted Dockerfiles Sep 29, 2023
@rotten rotten closed this Oct 23, 2023
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.

3 participants