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

build: optimize docker build by better utilizing build cache #21583

Merged
merged 2 commits into from
Oct 6, 2022
Merged

build: optimize docker build by better utilizing build cache #21583

merged 2 commits into from
Oct 6, 2022

Conversation

pwang2
Copy link
Contributor

@pwang2 pwang2 commented Sep 26, 2022

SUMMARY

Using common docker build practice to use docker build cache better.
New docker image build

  1. 394.79 MB -> 348.48 MB
  2. 3-5 minutes saving for initial build by not copying/deleting unneeded file, especial node_modules.
  3. merged the first stage to the lean image. still being able to cache the pip requirements installation.
  4. fix the random error when delete node_modules folder.

image

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

podman build -t superset  --no-cache --target lean -f ./Dockerfile

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️
We hope to see you in our Slack community too!

@EugeneTorap
Copy link
Contributor

EugeneTorap commented Oct 3, 2022

@pwang2 Thank you so much for this PR!
The changes should be speeds up docker build CI by 3-5 minutes.

Dockerfile Outdated Show resolved Hide resolved
Co-authored-by: EugeneTorap <evgenykrutpro@gmail.com>
@pwang2
Copy link
Contributor Author

pwang2 commented Oct 6, 2022

Receiving a lot of GitHub Actions failure which I believe should nothing to do with the change here. Can anyone help me figure out if anything missing from my side.

@zhaoyongjie zhaoyongjie changed the title misc: optimize docker build by better utilizing build cache build: optimize docker build by better utilizing build cache Oct 6, 2022
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM, leave one question for the py_ver argument in Node section.

Dockerfile Show resolved Hide resolved
Comment on lines +71 to +72
# setup.py uses the version information in package.json
COPY superset-frontend/package.json /app/superset-frontend/
Copy link
Member

Choose a reason for hiding this comment

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

IMO setup.py to read package.json isn't a good idea but exists a long time in Superset, might change this logic in the separated PR.

@zhaoyongjie zhaoyongjie merged commit 041c54e into apache:master Oct 6, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants