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

[Story][Dockerfile Improvements] Minimize The Number of Layers Needed to Be Rebuilt #1680

Closed
Tracked by #1646
p0mvn opened this issue Jun 6, 2022 · 1 comment
Closed
Tracked by #1646
Labels
T:build T:dev-UX T:story A story belongs to an epic

Comments

@p0mvn
Copy link
Member

p0mvn commented Jun 6, 2022

Background

As an Osmosis engineer, I would like to reduce the number of layers needed to be rebuilt on a small change so that I can be more productive when working on tasks.

Task 2.1 - Only COPY the desired components in Dockerfile

Currently, in most of our Dockerfiles, we copy the entire repository:

COPY . /osmosis

While this might seem convenient, it increases development time by requiring the entire repository to be copied every time one makes a small change.

It requires all subsequent layers to be rebuilt as well, further increasing the waiting time.

This is particularly frustrating when making changes to Dockerfiles that build the image. For example, a Dockerfile that the Osmosis image is built from does not have to be included in the image itself.

With the current design, since all codebase is copied over, a small tweak to any file causes the image to be rebuilt from scratch.
With the new design, we could copy only the items that we need. If a file that is not included in the image is changed (i.e. Dockerfile), it will not require the image to be rebuilt from the COPY directive:

COPY x/gov app Makefile /osmosis 

Additionally, this change will help to reduce the image size and reduce the likelihood of security vulnerabilities since only the relevant files are included in the final image.

Resources

Task 2.2 - Utilzie .dockerignore to exclude files commonly not needed in Osmosis containers

We should update .dockerignore excluding the files that are not needed. For example, .md files should probably not be in the final images.

Status

@ValarDragon
Copy link
Member

Closed by #2876

Repository owner moved this from Blocked ❌ to Done ✅ in Osmosis Chain Development Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:build T:dev-UX T:story A story belongs to an epic
Projects
Archived in project
Development

No branches or pull requests

2 participants