engine icon indicating copy to clipboard operation
engine copied to clipboard

Refactor Dockerfile to cache node_modules

Open d4mr opened this issue 5 months ago • 2 comments

PR-Codex overview

This PR focuses on optimizing the Docker build process for a Node.js application by restructuring the installation of dependencies and separating the production dependencies into a distinct stage.

Detailed summary

  • Added python3-pip installation.
  • Changed the copying order to first include package.json and yarn.lock for caching.
  • Simplified dependency installation by removing the redundant second install step.
  • Introduced a new build stage prod-deps for installing only production dependencies.
  • Updated the COPY command to pull node_modules from the prod-deps stage instead of the build stage.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

d4mr avatar Sep 25 '24 20:09 d4mr