openfaas / openfaas/faas-cli

Shrinkwrapping with jest takes 30 more seconds due to node_modules

Open
#889 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
816
Forks
230
Avg merge
6h 4m
Merged PRs (30d)
1

Description

Expected Behaviour

Shrinkwrapping a node project should not take long and should not copy node_modules into build directory because they are ignored by .dockerignore and installed during the build

Current Behaviour

Shrinkwrapping can take up to 30 seconds on a project where most of the function handler's dependencies are devDependencies (e.g. jest)

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

  • Add scripting to save and remove (stash) files/folders that you don't want copied before shrinkwrapping
  • Add scripting to re-add removed files after shrinkwrapping

Which Solution Do You Recommend?

I've proposed #888, but maybe there is a way to prefer using .dockerignore files when shrinkwrapping.

Steps to Reproduce (for bugs)

  1. Make a new handler using a node template
  2. npm i jest --save-dev to that handler
  3. faas-cli build --shrinkwrap
  4. Add more node_modules to see the copy process take longer

Context

Build time of 60+ seconds for simple projects

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):

  • Docker version ( Full output from: docker version ):

  • Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)?

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • Link to your project or a code example to reproduce issue:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the faas-cli build --shrinkwrap entry point and compare its handling of node_modules with .dockerignore during a Node.js handler build. Reproduce with npm i jest --save-dev, then verify that shrinkwrapping no longer copies unnecessary node_modules content and that build time improves without breaking the generated build directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, nodejs
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.