Skip to content

Commit

Permalink
fix: docker build args (#1816)
Browse files Browse the repository at this point in the history
* fix: fix dockerfile build args

* fix: fix dockerfile build args

* fix: fix dockerfile build args

* fix: fix dockerfile build args

* fix: fix dockerfile build args
  • Loading branch information
DokiDoki1103 authored Dec 28, 2023
1 parent f1a177a commit a783c87
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builder/build/dockerfile_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (d *dockerfileBuild) Build(re *Request) (*Response, error) {
}, nil
}

//The same component retains only one build task to perform
// The same component retains only one build task to perform
func (d *dockerfileBuild) stopPreBuildJob(re *Request) error {
jobList, err := jobc.GetJobController().GetServiceJobs(re.ServiceID)
if err != nil {
Expand Down Expand Up @@ -168,6 +168,13 @@ func (d *dockerfileBuild) runBuildJob(re *Request, buildImageName string) error
if len(re.BuildKitArgs) > 0 {
container.Args = append(container.Args, re.BuildKitArgs...)
}
for key := range re.BuildEnvs {
if strings.HasPrefix(key, "ARG_") {
envKey := strings.Replace(key, "ARG_", "", -1)
container.Args = append(container.Args, fmt.Sprintf("--opt=build-arg:%s=%s", envKey, re.BuildEnvs[key]))
}
}

container.VolumeMounts = mounts
podSpec.Containers = append(podSpec.Containers, container)
job.Spec = podSpec
Expand Down

0 comments on commit a783c87

Please sign in to comment.