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

Create smaller docker images #11

Merged
merged 2 commits into from
Aug 27, 2023
Merged

Conversation

cas--
Copy link
Contributor

@cas-- cas-- commented Feb 15, 2023

Thanks for this handy docker image however was rather surprised to find it was over 500MB so I refreshed my multi-stage docker skills to clean up the build and bring final size down to 100MB


Utilise multi-stage docker builds to reduce size from over 500MB to 100MB

  • Base image uses minimal dependencies to run scripts in final stage e.g. only
    using node in final CMD means we can move npm to compile stage.
  • Reduced dbus-python build dependencies to those actually required.
  • Using pip install --user to easily copy over Python requirements.
  • Bumped Python base image version to 3.10
  • Excluded unneeded files from final image.
  • Update package-lock.json

Utilise multi-stage docker builds to reduce size from over 500MB to 100MB

* Base image uses minimal dependencies to run scripts in final stage e.g. only
using node in final CMD means we can move npm to compile stage.
* Reduced dbus-python build dependencies to those actually required.
* Using `pip install --user` to easily copy over Python requirements.
* Bumped Python base image version to 3.10
* Excluded unneeded files from final image.
@cas--
Copy link
Contributor Author

cas-- commented Feb 15, 2023

I could have shaved another 1.2MB off the node_modules directory with node_prune but didn't think it was worth chasing that.

@cas-- cas-- marked this pull request as draft February 16, 2023 10:40
@cas-- cas-- marked this pull request as ready for review February 16, 2023 11:10
@hardillb
Copy link
Owner

Sorry it took a while, just remembered this.

@hardillb hardillb merged commit 5b59bad into hardillb:master Aug 27, 2023
@hardillb
Copy link
Owner

Hmm, this failed on the arm7 (32bit) build. Will investigate

@hardillb
Copy link
Owner

Fixed

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.

None yet

2 participants