This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 62513d515fb1186c697ff95e6b38a7f1b65e7280 Author: Antonin Stefanutti <[email protected]> AuthorDate: Thu Jul 29 12:25:26 2021 +0200 chore(native): Move to quarkus-distroless-image base image for native builds --- pkg/builder/image.go | 20 ++++++++++---------- pkg/trait/jvm.go | 10 +--------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/pkg/builder/image.go b/pkg/builder/image.go index b4f02c2..3d13d13 100644 --- a/pkg/builder/image.go +++ b/pkg/builder/image.go @@ -34,7 +34,7 @@ import ( const ( ContextDir = "context" - DeploymentDir = "/deployments" + DeploymentDir = "/home/nonroot" DependenciesDir = "dependencies" ) @@ -118,17 +118,17 @@ func imageContext(ctx *builderContext, selector artifactsSelector) error { return err } + err = os.Chmod(path.Join(contextDir, runner), 0755) + if err != nil { + return err + } + // #nosec G202 dockerfile := []byte(` - FROM ` + ctx.BaseImage + ` - ADD . ` + DeploymentDir + ` - - RUN chmod 775 ` + DeploymentDir + ` ` + DeploymentDir + `/` + runner + ` \ - && chown -R 1000 ` + DeploymentDir + ` \ - && chmod -R "g+rwX" ` + DeploymentDir + ` \ - && chown -R 1000:root ` + DeploymentDir + ` - - USER 1000 + FROM quay.io/quarkus/quarkus-distroless-image:1.0 + WORKDIR ` + DeploymentDir + ` + COPY --chown=nonroot:root ` + runner + ` ` + runner + ` + USER nonroot `) err = ioutil.WriteFile(path.Join(contextDir, "Dockerfile"), dockerfile, 0777) diff --git a/pkg/trait/jvm.go b/pkg/trait/jvm.go index c6a4b2b..5cefaae 100644 --- a/pkg/trait/jvm.go +++ b/pkg/trait/jvm.go @@ -185,15 +185,7 @@ func (t *jvmTrait) Apply(e *Environment) error { args = append(args, "-cp", strings.Join(items, ":")) args = append(args, e.CamelCatalog.Runtime.ApplicationClass) - if IsNilOrTrue(t.PrintCommand) { - args = []string{"exec", "./camel-k-integration-" + defaults.Version + "-runner"} - container.Command = []string{"/bin/sh", "-c"} - cmd := strings.Join(args, " ") - container.Args = []string{"echo " + cmd + " && " + cmd} - } else { - container.Command = []string{"./camel-k-integration-" + defaults.Version + "-runner"} - } - + container.Command = []string{"./camel-k-integration-" + defaults.Version + "-runner"} container.WorkingDir = builder.DeploymentDir return nil
