Skip to content

Add support to copy extra files from the Docker image to the package #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2019
Merged

Add support to copy extra files from the Docker image to the package #366

merged 2 commits into from
Jul 24, 2019

Conversation

jdufresne
Copy link
Contributor

This allows native OS libraries (*.so files) to be copied to the
serverless archive to be available at runtime. This introduces the new
option dockerExtraFiles, a list of paths on the Docker image to copy.

For example, the mysqlclient package requires
libmysqlclient.so.1020. One can now add an item to the
dockerExtraFiles option in their serverless.yml:

pythonRequirements:
  dockerExtraFiles:
    - /usr/lib64/mysql57/libmysqlclient.so.1020

This file will be available at runtime in the Lambda function.

This removes the need to manage these files in a more manual way and
avoids the need to commit binary files one's repository.

@jdufresne
Copy link
Contributor Author

Rebased to resolve conflicts.

Copy link
Contributor

@dschep dschep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the docs some more and make sure the diff is actually what's intended?

This allows native OS libraries (`*.so` files) to be copied to the
serverless archive to be available at runtime. This introduces the new
option `dockerExtraFiles`, a list of paths on the Docker image to copy.

For example, the `mysqlclient` package requires
`libmysqlclient.so.1020`. One can now add an item to the
`dockerExtraFiles` option in their `serverless.yml`:

    pythonRequirements:
      dockerExtraFiles:
        - /usr/lib64/mysql57/libmysqlclient.so.1020

This file will be available at runtime in the Lambda function.

This removes the need to manage these files in a more manual way and
avoids the need to commit binary files one's repository.
@jdufresne
Copy link
Contributor Author

Can you update the docs some more and make sure the diff is actually what's intended?

I'm happy to, is there something specific you're looking for beyond the inline comments? If you provide some guidance towards what you'd like to see, I'll fill in the rest.

Copy link
Contributor

@dschep dschep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i overlooked the "if you used the dockerfile from the prev sect' bit

@dschep dschep merged commit 647313c into serverless:master Jul 24, 2019
@crzypatchwork
Copy link

I'm having troubles with it. I need to have this OS library for a pip package, but I can't make it work no matter what.

custom:
  pythonRequirements:
    dockerizePip: True
    dockerExtraFiles:
    - ./libsodium.so

raise ValueError('Unable to find libsodium'), in <module>th_frames_removed

@jdufresne jdufresne deleted the copy-libraries branch December 21, 2020 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants