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] Reduce image build times #1682

Closed
Tracked by #1646
p0mvn opened this issue Jun 6, 2022 · 1 comment
Closed
Tracked by #1646

[Story][Dockerfile Improvements] Reduce image build times #1682

p0mvn opened this issue Jun 6, 2022 · 1 comment
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 image build times so that I don't waste time or focus on waiting for no reason.

This is a huge impediment to productivity where every time a developer makes a change to an image, they have to wait for around 4 minutes, and, as a result, lose the flow. The image build times should be minimized by structuring the steps and stages optimally and removing redundant steps.

Task 3.1 - Remove stale or redundant steps

Investigate all our images to remove stale or redundant steps that may have become such due to the repository evolving over time.

An example:

ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

We don't need to have ADD and RUN for both architectures in most Dockerfiles. Instead, we should provide architecture as an argument to the Dockerfile and only ADD and RUN wasm libraries for the desired one.

Task 3.2 - Leverage Build Cache

We should leverage build-cache by structuring the steps in each Dockerfile in such a fashion as so to minimize the rebuild frequency.

One example relevant to this issue is evident here:

osmosis/Dockerfile

Lines 17 to 23 in d5cd033

COPY . /osmosis
# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

COPY directive requires updates much more frequently than the subsequent ADDs and RUNs. As a result, every time we make a change to the codebase and attempt to rebuild an image, it will redundantly repeat ADD and RUN steps simply because these are located after COPY

Resources

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