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

OBS-504: Optimize Socorro builds for better FE dev speed #6908

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

toufali
Copy link
Contributor

@toufali toufali commented Feb 14, 2025

Currently when making changes to the FE build process (package.json, etc), most of the app image rebuilds unnecessarily. These FE changes also trigger a rebuild of the “devcontainer” image. Consequently, every change takes ~5 minutes on my machine.

With this PR build times are reduced to under 30 seconds (as tested on my machine)

@toufali toufali requested a review from a team as a code owner February 14, 2025 23:22
@toufali toufali requested review from smarnach and willkg February 14, 2025 23:22

# Install frontend JS deps
COPY --chown=app:app ./webapp/package*.json /webapp-frontend-deps/
RUN cd /webapp-frontend-deps/ && npm install
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that this will speed up installing new web dependencies, while it slows down updating Python dependencies, right? I don't have an opinion on this, just asking for clarification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's possible: if changes are made to the python dependencies it will rebuild the JS deps on the subsequent layer. However, my experience suggests the JS deps are minimal and build much faster than the python deps (seconds vs minutes).

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested making this change locally on your machine because it would speed up the loop you were doing often. I didn't intend to suggest we make this change globally.

Typically, we want to order steps in the Dockerfile to improve cache hits when doing typical work. We typically don't make changes to the JS environment, but we do land Python environment PRs from Dependabot and elsewhere, so we'll now be rebuilding the JS environment over and over. It doesn't add a lot on my machine (4s), so I'm game for making this change globally for everyone, but I would suggest we revert it it leads to longer build times for typical work.

Going back to the bigger problem of it taking a long time to build Socorro, it takes my machine 1m40s to do a full no-cache rebuild. It's curious it takes 4+ minutes for you. There might be other things you could look into to speed it up locally.

Co-authored-by: Sven Marnach <sven@marnach.net>
@toufali toufali requested a review from smarnach February 18, 2025 17:05
Copy link
Contributor

@willkg willkg left a comment

Choose a reason for hiding this comment

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

I had a minor suggestion, but this is largely fine.

If it turns out to slow our typical work down, we can revert the Dockerfile change.


# Install frontend JS deps
COPY --chown=app:app ./webapp/package*.json /webapp-frontend-deps/
RUN cd /webapp-frontend-deps/ && npm install
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested making this change locally on your machine because it would speed up the loop you were doing often. I didn't intend to suggest we make this change globally.

Typically, we want to order steps in the Dockerfile to improve cache hits when doing typical work. We typically don't make changes to the JS environment, but we do land Python environment PRs from Dependabot and elsewhere, so we'll now be rebuilding the JS environment over and over. It doesn't add a lot on my machine (4s), so I'm game for making this change globally for everyone, but I would suggest we revert it it leads to longer build times for typical work.

Going back to the bigger problem of it taking a long time to build Socorro, it takes my machine 1m40s to do a full no-cache rebuild. It's curious it takes 4+ minutes for you. There might be other things you could look into to speed it up locally.

Co-authored-by: Will Kahn-Greene <willkg@users.noreply.github.com>
@toufali toufali added this pull request to the merge queue Feb 18, 2025
Merged via the queue into main with commit b541861 Feb 18, 2025
1 check passed
@toufali toufali deleted the OBS-504/update-build-process branch February 18, 2025 20:40
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.

4 participants