Allow packaging of static files alongside binary
See original GitHub issue💡 Feature description
It would be nice if it was possible to use the include
and exclude
package configuration in serverless.yml
to choose other files to bundle with the bootstrap binary. For example to include a .env
file that is then read by the dotenv crate at runtime.
I am sure that there are other use cases for including files other than the binary but that is the one that sprang to mind.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:12 (4 by maintainers)
Top Results From Across the Web
The easiest way to embed static files into a binary file in your ...
The easiest way to embed static files into a binary file in your Golang app (no external dependencies). Just git clone and read...
Read more >Embedding static files in a go binary using go embed
I have been using packages like pkgr and packr to make it easier to embed static files in go binaries. We'll explore the...
Read more >Bundling static files in binary : r/rust - Reddit
In Golang, there are libraries that allow you to embed the static files of your project into a single binary (go.rice, packr, go-bindata)....
Read more >How to serve static files from a compiled binary? #2005 - GitHub
I don't think you need to put anything IN the binary to achieve that, you can simply zip templates and static files together...
Read more >Embedding static files in Go binaries | by Tiago Temporin
Released in version 1.16, the embed package gives us a new directive to help ... BIG binaries, which can be a bigger problem...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
An alternative solution to the static file packaging problem is to use AWS Lambda Layers. Just put your static files into some directory at the root of your project and create a layer from that.
Example:
In your serverless.yml insert:
In your function you can put the dependency on your layer as a title cased reference:
You can now access your files as if they are located in the “/opt” folder of your lambda, e.g.:
This solution is quite useful especially when you want to share your static data between different lambdas.
Without more expertise in opencv I cant gaurantee this will work but to answer the question about using layers to package host dependencies, that’s almost the sole use of layers https://aws.amazon.com/blogs/aws/new-for-aws-lambda-use-any-programming-language-and-share-common-components/
That said this is likely an easier case for interpreted languages im not sure if you can package and dynamically link via env var with rust. I glanced through the opencv docs and there was some suggestions that you could