Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify fast jar dockerfiles by only using a single copy command. #10634

Merged
merged 1 commit into from Jul 16, 2020

Conversation

andreas-eberle
Copy link
Contributor

Use only a single COPY command in the fast jar dockerfile templates.

@boring-cyborg boring-cyborg bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform labels Jul 10, 2020
COPY --chown=1001 ${build_dir}/quarkus-app/*.jar /deployments/
COPY --chown=1001 ${build_dir}/quarkus-app/app/ /deployments/app/
COPY --chown=1001 ${build_dir}/quarkus-app/quarkus/ /deployments/quarkus/
COPY --chown=1001 ${build_dir}/quarkus-app /deployments/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it equivalent? I would expect this to copy the quarkus-app directory inside /deployments/ whereas we used to copy the content of this directory, meaning the main jar was at the root of /deployments/.

At least if Docker's COPY has the same semantic as cp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally by adding a RUN ls /deployments line after that and the log shows that the contents of the directory have been copied:

Step 13/17 : COPY --from=builder --chown=1001 /usr/src/app/bff/build/quarkus-app /deployments/
 ---> Using cache
 ---> 61e79dc8db06
Step 14/17 : RUN ls /deployments
 ---> Running in 5124e52a774d
app
lib
quarkus
quarkus-run.jar
run-java.sh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. That's a bit weird IMO but not familiar with Docker so I trust you :).

That being said, I'm wondering if we could change that to:

COPY --chown=1001 ${build_dir}/quarkus-app/* /deployments/

to be on the safe side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this seems to unpack the directories in the quarkus-app directory. The ls now shows

app-1.0.0-SNAPSHOT.jar
boot
generated-bytecode.jar
main
quarkus-application.dat
quarkus-run.jar
run-java.sh
transformed-bytecode.jar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsmet: In the docker copy docs, I just found a note saying the following about the src path:

The directory itself is not copied, just its contents.

Furthermore, the pattern matching seems to the one Golang uses. Therefore I think it doesn't apply the standard linux semantics.

@andreas-eberle
Copy link
Contributor Author

@gsmet: Is there anything more you need for this?

@gsmet
Copy link
Member

gsmet commented Jul 16, 2020

Yes, let's merge it thanks!

Sorry for wasting your time with my questions :).

@gsmet gsmet merged commit d7b0510 into quarkusio:master Jul 16, 2020
@andreas-eberle
Copy link
Contributor Author

Better safe than sorry! :)

@gsmet gsmet added this to the 1.6.1.Final milestone Jul 16, 2020
@stuartwdouglas
Copy link
Member

This is now no longer layered, so even if you just change one thing in your app you need to re-ship all the libraries.

@stuartwdouglas
Copy link
Member

#10892

@andreas-eberle andreas-eberle deleted the simplify-fastjar-dockerfile branch August 25, 2020 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants