Skip to content

Commit

Permalink
Copy openrewrite source from mount to container (konveyor#173) (konve…
Browse files Browse the repository at this point in the history
…yor#174)

copy openrewrite source from mount to container

Signed-off-by: Emily McMullan <[email protected]>
Co-authored-by: Emily McMullan <[email protected]>
  • Loading branch information
pranavgaikwad and eemcmullan authored Mar 12, 2024
1 parent 7ed233d commit ef31e59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,6 +42,7 @@ COPY --from=rulesets /rulesets/default/generated /opt/rulesets
COPY --from=rulesets /windup-rulesets/rules/rules-reviewed/openrewrite /opt/openrewrite
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 entrypoint.sh /usr/bin/entrypoint.sh
COPY --chmod=755 entrypoint.sh /usr/bin/entrypoint.sh
COPY --chmod=755 openrewrite_entrypoint.sh /usr/bin/openrewrite_entrypoint.sh

ENTRYPOINT ["kantra"]
4 changes: 2 additions & 2 deletions cmd/openrewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions openrewrite_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ef31e59

Please sign in to comment.