From bd0ccbf93f033023ebf26c4f262cf5f9db77dcd7 Mon Sep 17 00:00:00 2001 From: Emily McMullan Date: Fri, 8 Mar 2024 14:46:27 -0500 Subject: [PATCH] copy openrewrite source from mount to container Signed-off-by: Emily McMullan --- Dockerfile | 3 ++- cmd/openrewrite.go | 4 ++-- openrewrite_entrypoint.sh | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 openrewrite_entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 1639b88..166939f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build --ldflags="-X 'github.com/k FROM quay.io/konveyor/analyzer-lsp:latest -RUN mkdir /opt/rulesets /opt/rulesets/input /opt/rulesets/convert /opt/openrewrite /opt/input /opt/input/rules /opt/input/rules/custom /opt/output /opt/xmlrules /opt/shimoutput +RUN mkdir /opt/rulesets /opt/rulesets/input /opt/rulesets/convert /opt/openrewrite /opt/input /opt/input/rules /opt/input/rules/custom /opt/output /opt/xmlrules /opt/shimoutput /tmp/source-app /tmp/source-app/input COPY --from=builder /workspace/kantra /usr/local/bin/kantra COPY --from=builder /workspace/darwin-kantra /usr/local/bin/darwin-kantra @@ -43,5 +43,6 @@ COPY --from=rulesets /windup-rulesets/rules/rules-reviewed/openrewrite /opt/open COPY --from=static-report /usr/bin/js-bundle-generator /usr/local/bin COPY --from=static-report /usr/local/static-report /usr/local/static-report COPY --chmod=755 entrypoint.sh /usr/bin/entrypoint.sh +COPY --chmod=755 openrewrite_entrypoint.sh /usr/bin/openrewrite_entrypoint.sh ENTRYPOINT ["kantra"] diff --git a/cmd/openrewrite.go b/cmd/openrewrite.go index 6152115..b9e840d 100644 --- a/cmd/openrewrite.go +++ b/cmd/openrewrite.go @@ -154,9 +154,9 @@ func (o *openRewriteCommand) Run(ctx context.Context) error { err := NewContainer(o.log).Run( ctx, WithEntrypointArgs(args...), - WithEntrypointBin("/usr/bin/mvn"), + WithEntrypointBin("/usr/bin/openrewrite_entrypoint.sh"), WithVolumes(volumes), - WithWorkDir(InputPath), + WithWorkDir("/tmp/source-app/input"), WithCleanup(o.cleanup), ) if err != nil { diff --git a/openrewrite_entrypoint.sh b/openrewrite_entrypoint.sh new file mode 100644 index 0000000..0596012 --- /dev/null +++ b/openrewrite_entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -x + +cp -r /opt/input /tmp/source-app +/usr/bin/mvn "$@" +cp -r /tmp/source-app/input /opt