Reputation: 9966
I have create a dummy project with Quarkus' Maven archetype in Java. I want to copy the whole build context into my Docker container.
When I perform ls -al
in the current directory I get this result:
drwxr-xr-x 12 my.user staff 384 19 Aug 15:57 .
drwxr-xr-x 12 my.user staff 384 19 Aug 15:39 ..
-rw-r--r-- 1 my.user staff 53 19 Aug 15:39 .dockerignore
-rw-r--r-- 1 my.user staff 295 19 Aug 15:39 .gitignore
drwxr-xr-x 7 my.user staff 224 19 Aug 15:45 .idea
drwxr-xr-x 3 my.user staff 96 19 Aug 15:39 .mvn
-rw-r--r-- 1 my.user staff 78 19 Aug 15:57 Dockerfile
-rwxrwxr-x 1 my.user staff 10078 19 Aug 15:39 mvnw
-rw-rw-r-- 1 my.user staff 6609 19 Aug 15:39 mvnw.cmd
-rw-r--r-- 1 my.user staff 3691 19 Aug 15:39 pom.xml
drwxr-xr-x 4 my.user staff 128 19 Aug 15:39 src
drwxr-xr-x 15 my.user staff 480 19 Aug 15:40 target
This is my Dockerfile
:
FROM maven:3-jdk-11-slim
WORKDIR /home/mvn
COPY ./ .
RUN ls -al
RUN mvn verify
Unfortunately only the target folder gets copied. This is the resulting output from docker build .
:
Sending build context to Docker daemon 8.425MB
Step 1/5 : FROM maven:3-jdk-11-slim
---> b67032e30f89
Step 2/5 : WORKDIR /home/mvn
---> Running in 90dc6171c4be
Removing intermediate container 90dc6171c4be
---> 3cf149c09c43
Step 3/5 : COPY ./ .
---> bf0869cf8577
Step 4/5 : RUN ls -al
---> Running in 733891348a3c
total 12
drwxr-xr-x 1 root root 4096 Aug 19 14:00 .
drwxr-xr-x 1 root root 4096 Aug 19 14:00 ..
drwxr-xr-x 3 root root 4096 Aug 19 14:00 target
Removing intermediate container 733891348a3c
---> f425feab5580
Step 5/5 : RUN mvn verify
---> Running in 29e2dae052f6
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.078 s
[INFO] Finished at: 2019-08-19T14:00:51Z
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/mvn). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
The command '/bin/sh -c mvn verify' returned a non-zero code: 1
What could be the error here?
Upvotes: 0
Views: 1005
Reputation: 9966
The Quarkus Maven archetype added a .dockerignore
file. In it only the target
folder was not excluded from Docker. Hence only the target
folder has been copied.
Upvotes: 2