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

refactor(Dockerfile): optimize container image #34

Merged
merged 1 commit into from
Mar 20, 2023
Merged

Conversation

Hazmi35
Copy link
Collaborator

@Hazmi35 Hazmi35 commented Mar 20, 2023

Some points:

  • We don't need label on build stage, you don't label incomplete products in factory yes?
  • It is prefered to use --no-cache in apk, to not cache package indexes, especially in final image, and will reduce image size
  • Golang is a compiled language, without any Intermediate Language like Bytecode in Java, thus you don't need to install Golang in final image
  • It is advised to not run your app as a PID 1 in container, and using an init system. For containers, we just need a simple init system like tini, some of the benefits you can see here: why-tini

This reduces image from 320MB to 71.4MB in size.

@KagChi KagChi merged commit 06d9bde into main Mar 20, 2023
@KagChi KagChi deleted the optimize-docker-img branch March 20, 2023 14:34
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.

2 participants