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

Slim down produced docker image #11

Merged
merged 2 commits into from Jul 5, 2023
Merged

Slim down produced docker image #11

merged 2 commits into from Jul 5, 2023

Conversation

BorePlusPlus
Copy link
Contributor

Save the bytes! Also, make builds without cached layers faster. And images lighter to move around.

Basic stuff like:

  • using slim image
  • adding node_modules to .dockerignore

Some additional changes due to:

Question: Should we pin the OS version to avoid such surprises in the future?
PRO: Consistent OS experience.
CON: OS version has to be bumped manually on a new release.

Resources

New image size: 648MB
Original image size: 1.62GB

Save the bytes! Also make builds without cached layers faster. And
images lighter to move around.

Basic stuff like:
  - using slim image
  - adding node_modules to .dockerignore

Some aditional changes due to:
  - New slim debian image (bookworm) no longer bundles libssl, so it has
    to be install explicitly as prisma depends on it. See: nodejs/docker-node#1919
  - Bookworm uses different version of libssl 3.0.x rather than 1.1.x
    which necesatates update to prisma schema.
  - Prisma client itself has to be updated to support libssl 3.0.x.

Question: Should we pin the OS version to avoid such surprises in the
future?
PRO: Consistent OS experience.
CON: OS version has to be bumped manually on new release.

Resources

- Some recommendations regarding images: https://snyk.io/blog/choosing-the-best-node-js-docker-image/
- Why dockerignore: https://codefresh.io/blog/not-ignore-dockerignore-2/

New image size: 648MB
Original image size: 1.62GB
Copy link
Contributor

@mzgajner mzgajner left a comment

Choose a reason for hiding this comment

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

New image size: 648MB
Original image size: 1.62GB

💯 Thanks for the extensive explanation too.

I wouldn't pin the OS version for now, simply because this is currently just a way to set up the dev environment. We can reconsider if/when it becomes an actual production image.

Dockerfile Outdated Show resolved Hide resolved
@BorePlusPlus BorePlusPlus merged commit dd44243 into main Jul 5, 2023
@BorePlusPlus BorePlusPlus deleted the slim-docker branch July 5, 2023 13:29
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