Skip to content

Shrinkwrapping with jest takes 30 more seconds due to node_modules #889

Open
@tatemz

Description

@tatemz

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions