Skip to content

Option to choose output folder of dockerExtraFiles #392

Open
@mojimi

Description

@mojimi

Thanks @jdufresne for adding the new feature that adds and documents a way of adding extra base libraries to the lambda.

But at the moment it won't work properly for layers, as the lambda environment will look for so libs in the lib folder, just like it look for python libs in the python folder as you can see here https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path

I don't know much about PR, but judging from the line here : https://github.com/UnitedIncome/serverless-python-requirements/blob/529b9da27930ff57dc061069ab0007d5dc7fe55a/lib/pip.js#L257 , this could be a simple solution (rough idea) :

for (let path of options.dockerExtraFiles) {
    if (typeof path === "string") {
        pipCmds.push(['cp', path, '/var/task/']);
    }else{
        pipCmds.push(['cp'], path.from, '/var/task' + path.to])
    }
}

Which would use the following syntax in yaml :

dockerExtraFiles:
      - /usr/lib64/libcairo-1.0.so.0
      - from : /usr/lib64/libpango-1.0.so.0
         to : /lib/

Problem is, I don't know if this would be enough for a layer, since it might just put into /python/lib

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions