serverless-rack
serverless-rack copied to clipboard
How do you pass environment variables to the build container?
Hi logandk,
I need to use a different container other than the default or lambci/lambda:build-ruby2.7
to target the aarch64-Linux architecture. So I'm using public.ecr.aws/sam/build-ruby2.7:latest-arm64
.
I also have private gems I need to bring into the bundle. And there are two ways I know how to do that. Either by using a bundle config command or by environment variables, as explained here: https://bundler.io/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCES
I've tried this, but I don't think the environment variables are being passed to the container.
provider:
name: aws
stage: ${opt:stage}
region: ${opt:region}
runtime: ruby2.7
architecture: arm64
environment:
BUNDLE_GEMS__LONGEROUS__COM: "claudette:s00pers3krit"
And looking at this, it doesn't look like there is a way to do custom docker args: https://github.com/logandk/serverless-rack/blob/7364305bcbbf7f6cc6851497069a5a4cb91936b1/index.js#L42-L48
Is what I'm trying to do possible via configuration instead of needing to create a custom image?
Thanks, John
It looks like there is only one environment variable allowed and that is BUNDLER_ARGS
.
https://github.com/logandk/serverless-rack/blob/master/index.js#L381
@logandk would you be okay with a PR that allowed for more environment variables to be passed to the docker container?
-John
Sorry, I missed this issue - would definitely accept a PR
Hi @logandk,
I'm no longer on the project where that was using serverless. Feel free to close this.
I'll reach out to my former group and let them know they could create a PR if they wanted.
Thanks, John