@@ -70,16 +70,19 @@ function bundleInstall(){
7070 fs . copySync ( docker_file_path ,
7171 path . join ( this . ruby_layer , 'Dockerfile' ) )
7272 buildDocker = true
73- } else if ( this . options . docker_yums ) {
73+ } else if ( this . options . docker_yums || this . options . environment ) {
7474 docker_steps = [ 'FROM lambci/lambda:build-' + this . serverless . service . provider . runtime ]
75- this . options . docker_yums . forEach ( function ( package_name ) {
76- docker_steps . push ( 'RUN yum install -y ' + package_name )
77- } )
75+ if ( this . options . docker_yums ) {
76+ this . options . docker_yums . forEach ( function ( package_name ) {
77+ docker_steps . push ( 'RUN yum install -y ' + package_name )
78+ } )
79+ }
7880 docker_steps . push ( 'RUN gem update bundler' )
79- if ( this . options . docker_env_variable ) {
80- this . options . docker_env_variable . forEach ( function ( build_arg ) {
81- docker_steps . push ( 'ARG ' + build_arg )
82- docker_steps . push ( 'ENV ' + build_arg + '=${' + build_arg + '}' )
81+ if ( this . options . environment ) {
82+ this . options . environment . forEach ( function ( env_arg ) {
83+ env_arg_name = env_arg . split ( '=' ) [ 0 ]
84+ docker_steps . push ( 'ARG ' + env_arg_name )
85+ docker_steps . push ( 'ENV ' + env_arg_name + '=${' + env_arg_name + '}' )
8386 } )
8487 }
8588 docker_steps . push ( 'CMD "/bin/bash"' )
@@ -90,16 +93,10 @@ function bundleInstall(){
9093 this . cli . log ( "Building docker for bundle install" )
9194 docker_name = 'ruby-layer:docker'
9295 docker_args = [ 'build' , '-t' , docker_name , '-f' , 'Dockerfile' ]
93- if ( this . options . docker_build_args ) {
94- this . options . docker_build_args . forEach ( function ( build_arg ) {
95- docker_args . push ( '--build-arg' )
96- docker_args . push ( build_arg )
97- } )
98- }
99- if ( this . options . docker_env_variable ) {
100- this . options . docker_env_variable . forEach ( function ( build_arg ) {
96+ if ( this . options . environment ) {
97+ this . options . environment . forEach ( function ( env_arg ) {
10198 docker_args . push ( '--build-arg' )
102- docker_args . push ( build_arg )
99+ docker_args . push ( env_arg )
103100 } )
104101 }
105102 docker_args . push ( '.' )
0 commit comments