Skip to content

Optimize Dockerfile to Improve Build Efficiency and Reduce Rebuilds #931

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

Closed
wants to merge 1 commit into from

Conversation

devanmolx
Copy link

@devanmolx devanmolx commented Mar 6, 2025

Description

Optimized the Dockerfile to improve build performance by leveraging Docker layer caching. The change moves the npm install step to run after copying only package*.json, so dependencies don't need to be reinstalled unless package.json changes. This reduces rebuild times when modifying source code files.

Related issue

#930

How Has This Been Tested?

Tested the changes by building the Docker image before and after modifying the Dockerfile. Verified that:

1.) Rebuilding after modifying source code does not rerun npm install.
2.) Image builds faster as dependencies are cached unless package.json changes.

Screenshots (if appropriate):

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@dpgiakatos
Copy link
Member

Violation of contribution guidelines:
PRs from contributors who are not assigned to an issue will be automatically closed.

@dpgiakatos dpgiakatos closed this Mar 7, 2025
@devanmolx devanmolx deleted the issue-930 branch March 9, 2025 06:12
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