aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.66k stars 1.01k forks source link

Reference pre-built binary in vendor folder #377

Closed dkoutsou closed 7 years ago

dkoutsou commented 7 years ago

I have written an API using chalice that does some processing of audio files. For the processing I am using ffmpeg. I have a pre-built version of ffmpeg included in the /vendor folder and I want to call this executable (using subprocess) from a function that is located in the /chalicelib folder. Is this possible? If so, what is the structure of the application inside the lambda in order to include the absolute path in the subprocess call?

stealthycoin commented 7 years ago

If your chalice directory looks like this:

.
├── app.py
├── before
├── chalicelib
│   └── customcode
│       └── __init__.py
├── requirements.txt
└── vendor
    ├── fake.so
    └── vendored_lib
        └── __init__.py

Then your deployment package will look like this:

.
├── app.py
├── chalice
│   ├── __init__.py
│   └── app.py
├── chalicelib
│   └── customcode
│       └── __init__.py
├── fake.so
├── vendored_lib
│   └── __init__.py

The top app.py is your code.

aalvrz commented 3 months ago

@stealthycoin How should .so files be placed within vendor/ in order for them to get loaded properly on the deployed application when using automatic lambda layers?