serverless-layers icon indicating copy to clipboard operation
serverless-layers copied to clipboard

Allow layer creation of user built modules

Open AmanL04 opened this issue 3 years ago • 1 comments

I am new to serverless and from the jump, I noticed that layers using the plugin "serverless-layers" cannot include user-defined modules (common code).

Please add support to allow layer creation from folders (which can also include requirements.txt)

AmanL04 avatar Nov 27 '20 18:11 AmanL04

Inspecting the source code, I found this undocumented option copyBeforeInstall

  serverless-layers:
    customInstallationCommand: npm run myCustomCommand # If you use NodeJS, but you can set the command that suits your case
    copyBeforeInstall:
      - package-lock.json  # Again, if you use NodeJS so please check the repo for default files needed for every package manager
      - path/to/custom/files # This file will be part of the layers

In addition, the customInstallationCommand option can give the flexibility needed to do anything with copyBeforeInstall files set.

m0uneer avatar Jul 18 '23 02:07 m0uneer