Skip to content

Commit

Permalink
[REV] support parse ARG variable value
Browse files Browse the repository at this point in the history
  • Loading branch information
barnettZQG committed Mar 5, 2019
1 parent 81c7f10 commit 260f551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 9 additions & 1 deletion builder/build/dockerfile_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/goodrain/rainbond/builder"
"github.com/goodrain/rainbond/builder/sources"
"github.com/goodrain/rainbond/util"
)

func dockerfileBuilder() (Build, error) {
Expand Down Expand Up @@ -86,16 +87,23 @@ func (d *dockerfileBuild) Build(re *Request) (*Response, error) {
}, nil
}

//GetARGs get args and parse value
func GetARGs(buildEnvs map[string]string) map[string]*string {
args := make(map[string]*string, 5)
args := make(map[string]*string)
argStr := make(map[string]string)
for k, v := range buildEnvs {
if strings.Replace(v, " ", "", -1) == "" {
continue
}
if ks := strings.Split(k, "ARG_"); len(ks) > 1 {
value := v
args[ks[1]] = &value
argStr[ks[1]] = value
}
}
for k, arg := range args {
value := util.ParseVariable(*arg, argStr)
args[k] = &value
}
return args
}
1 change: 0 additions & 1 deletion hack/contrib/docker/gateway/nginxtmp/tmpl/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ http {
server 0.0.0.1; # placeholder

balancer_by_lua_block {
ngx.log(ngx.INFO, string.format("start balancer"))
balancer.balance()
}
}
Expand Down

0 comments on commit 260f551

Please sign in to comment.