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

Replace final image base to be alpine #353

Merged

Conversation

BobyMCbobs
Copy link
Contributor

@BobyMCbobs BobyMCbobs commented Oct 10, 2020

Goal

Currently work-in-progress.

The final container image can be reduced by ~75% by replacing the base with alpine.

plausible/analytics                       bobymcbobs          4fb17172ceb0        10 minutes ago      57.5MB
plausible/analytics                       dev                 a7d58b5d74da        16 hours ago        242MB

The size of the container image is important as:

  • in some environment there may not be a lot of storage
  • nodes can run out of storage and cause problems
  • if it can be reduced, it should be

Changes

Please describe the changes made in the pull request here.

Below you'll find a checklist. For each item on the list, check one option and delete the other.

Tests

  • Automated tests have been added
  • This PR does not require tests

Changelog

  • Entry has been added to changelog
  • This PR does not make a user-facing change

Documentation

  • Docs have been updated
  • This change does not need a documentation update

@BobyMCbobs
Copy link
Contributor Author

Currently getting the error:

/app/releases/0.0.1/../../erts-10.7.2.1/bin/erl: exec: line 12: /app/erts-10.7.2.1/bin/erlexec: not found

according to

/app # file erts-10.7.2.1/bin/erlexec
erts-10.7.2.1/bin/erlexec: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=ef464f52ec7d693c667eaaff8fc0b851e262ed70, with debug_info, not stripped

the binary is not statically linked, so it depends a bit on the system it was built on (being Debian).

@BobyMCbobs
Copy link
Contributor Author

May or may not be related but at least with Erlang, it is possible to use scratch (nothing) as the base image, so it can only contain the app and nothing OS related.

https://github.com/shortishly/erlang-in-docker-from-scratch

@ukutaht
Copy link
Contributor

ukutaht commented Oct 12, 2020

Awesome! I'd love to reduce the final image size

@BobyMCbobs BobyMCbobs force-pushed the reduce-final-container-image-size branch from fb8a86a to 32d4a06 Compare October 15, 2020 08:37
@BobyMCbobs BobyMCbobs marked this pull request as ready for review October 15, 2020 08:39
@BobyMCbobs
Copy link
Contributor Author

In the latest commit, the image size has been further reduced:

plausible/analytics                       bobymcbobs          5f0b46b91d10        5 minutes ago       29.3MB
plausible/analytics                       dev                 3eade4a07b9c        9 minutes ago       242MB
plausible/analytics                       latest              edc04495bd46        20 hours ago        258MB

@BobyMCbobs BobyMCbobs changed the title WIP Replace final image base to be alpine Replace final image base to be alpine Oct 15, 2020
@BobyMCbobs BobyMCbobs force-pushed the reduce-final-container-image-size branch from 255fc3d to 3292583 Compare October 15, 2020 08:51
@BobyMCbobs
Copy link
Contributor Author

Note:

@BobyMCbobs
Copy link
Contributor Author

@ukutaht, this PR is ready! 😄
May I please have a review?

@ukutaht
Copy link
Contributor

ukutaht commented Oct 19, 2020

Looks good to me! Thanks a ton

@ukutaht ukutaht merged commit a956d58 into plausible:master Oct 19, 2020
ukutaht added a commit that referenced this pull request Oct 19, 2020
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