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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,10 +45,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

COPY --chown=1001 ${build_dir}/quarkus-app/lib/ /deployments/lib/
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.


EXPOSE 8080
USER 1001
Expand Down
Expand Up @@ -45,10 +45,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

COPY ${build_dir}/quarkus-app/lib/* /deployments/lib/
COPY ${build_dir}/quarkus-app/*.jar /deployments/
COPY ${build_dir}/quarkus-app/app/* /deployments/app/
COPY ${build_dir}/quarkus-app/quarkus/* /deployments/quarkus/
COPY ${build_dir}/quarkus-app /deployments/

EXPOSE 8080
USER 1001
Expand Down