Serverless-webpack: Docker-Lambci Packaging of external native modules

Created on 28 May 2018  路  4Comments  路  Source: serverless-heaven/serverless-webpack

We need an feature to run npm rebuild/install inside of a docker lambci container, during the includeModules step.
Only so will the right native binaries be built.

duplicate question

All 4 comments

Hi @heri16 , this is already available. See https://github.com/serverless-heaven/serverless-webpack/issues/342#issuecomment-383248835 for an example where the gprc library is rebuilt for the correct node version and target operating system.

The way to go here is to add a scripts section to the packager options:

# serverless.yml
custom:
  webpack:
    ...
    packagerOptions:
      scripts:
        - npm rebuild grpc --target=8.1.0 --target_arch=x64 --target_platform=linux --target_libc=glibc

@heri16 Did you try the script feature?

Hi @heri16, closing this issue since there is a documented workaround. Please let us know if the issue persists and we can re-open it 馃槈

The script doesn't seem to work for node-canvas.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bitttttten picture bitttttten  路  4Comments

deftomat picture deftomat  路  5Comments

vladtamas picture vladtamas  路  5Comments

jaydp17 picture jaydp17  路  4Comments

agreea picture agreea  路  3Comments