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

fast-jar : COPY target/quarkus-app/lib : no such file or directory #12324

Closed
yurake opened this issue Sep 24, 2020 · 12 comments
Closed

fast-jar : COPY target/quarkus-app/lib : no such file or directory #12324

yurake opened this issue Sep 24, 2020 · 12 comments
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@yurake
Copy link

yurake commented Sep 24, 2020

Describe the bug
docker build using Dockerfile.fast-jar is failed.

Expected behavior
docker image was created.

Actual behavior

COPY failed: stat /var/lib/docker/tmp/docker-builder045695131/target/quarkus-app/lib: no such file or directory
Step 7/13 : COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue.

Steps to reproduce the behavior:

  1. mvn -B verify package
  2. docker build -t {image org/name:version} -f src/main/docker/Dockerfile.fast-jar .

Configuration

# Configuration file
# key = value

# package
quarkus.package.type=fast-jar

# log
quarkus.log.console.enable=true
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
quarkus.log.console.level=DEBUG
quarkus.log.console.color=true
quarkus.log.category."io.quarkus".level=INFO

# Opentracing
quarkus.jaeger.service-name=jaxrs-memcached-quarkus
quarkus.jaeger.sampler-type=const
quarkus.jaeger.sampler-param=1
quarkus.jaeger.agent-host-port=jaeger-agent:6831

# message
common.message=Hello k8s-3tier-webapp with quarkus

# memcached
memcached.server.conf=memcached:11211
%test.memcached.server.conf=memcached:11211

Environment (please complete the following information):

  • Output of java -version:
    openjdk version "11.0.8" 2020-07-14
    OpenJDK Runtime Environment GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03)
    OpenJDK 64-Bit Server VM GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03, mixed mode, sharing)
  • Quarkus version or git rev:
    1.8.1-Final
@yurake yurake added the kind/bug Something isn't working label Sep 24, 2020
@iocanel iocanel self-assigned this Sep 25, 2020
@iocanel
Copy link
Contributor

iocanel commented Sep 25, 2020

Hi @yurake: I think that the steps you used are not correct.
In order to use the fast-jar dockerfile you first need to build using the fast jar option.

Please try:

mvn package -Dquarkus.package.type=fast-jar
cker build -t {image org/name:version} -f src/main/docker/Dockerfile.fast-jar .

@yurake
Copy link
Author

yurake commented Sep 25, 2020

Hi @iocanel, I tried your suggestion on my MacBook but still not worked.

$ ./mvnw clean package -Dquarkus.package.type=fast-jar -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< webapp.3tier.k8s:jaxrs-memcached-quarkus >--------------
[INFO] Building jaxrs-memcached-quarkus 0.4.2-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jaxrs-memcached-quarkus ---
[INFO] Deleting /Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (default) @ jaxrs-memcached-quarkus ---
[INFO] argLine set to -javaagent:/Users/yurak/.m2/repository/org/jacoco/org.jacoco.agent/0.8.6/org.jacoco.agent-0.8.6-runtime.jar=destfile=/Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jaxrs-memcached-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ jaxrs-memcached-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jaxrs-memcached-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ jaxrs-memcached-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ jaxrs-memcached-quarkus ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jaxrs-memcached-quarkus ---
[INFO] Building jar: /Users/yurak/git/k8s-3tier-webapp-minikube/application/jaxrs-memcached-quarkus/target/jaxrs-memcached-quarkus-0.4.2-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:1.8.1.Final:build (default) @ jaxrs-memcached-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1272ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.662 s
[INFO] Finished at: 2020-09-26T00:39:08+09:00
[INFO] ------------------------------------------------------------------------

$ docker build -t yurak/jaxrs-memcached-quarkus:latest -f src/main/docker/Dockerfile.fast-jar .
Sending build context to Docker daemon   5.12kB
Step 1/13 : FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
 ---> 91d23a64fdf2
Step 2/13 : ARG JAVA_PACKAGE=java-11-openjdk-headless
 ---> Using cache
 ---> 1632837e96d4
Step 3/13 : ARG RUN_JAVA_VERSION=1.3.8
 ---> Using cache
 ---> a1d7c0c97d30
Step 4/13 : ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
 ---> Using cache
 ---> a2586366f92b
Step 5/13 : RUN microdnf install curl ca-certificates ${JAVA_PACKAGE}     && microdnf update     && microdnf clean all     && mkdir /deployments     && chown 1001 /deployments     && chmod "g+rwX" /deployments     && chown 1001:root /deployments     && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh     && chown 1001 /deployments/run-java.sh     && chmod 540 /deployments/run-java.sh     && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security
 ---> Using cache
 ---> 6662b8bdd5b7
Step 6/13 : ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
 ---> Using cache
 ---> b96c8f09874c
Step 7/13 : COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
COPY failed: stat /var/lib/docker/tmp/docker-builder417950358/target/quarkus-app/lib: no such file or directory

@iocanel iocanel removed their assignment Sep 29, 2020
@iocanel
Copy link
Contributor

iocanel commented Oct 5, 2020

I unassigned myself, as I am not an OSX user and this is possibly related to how docker on OSX works.

@yurake
Copy link
Author

yurake commented Oct 7, 2020

This error has occurred both on OSX and on GitHub Actions.

@geoand
Copy link
Contributor

geoand commented Feb 26, 2021

Is this still an issue?

@arnoutvw
Copy link

Is this still an issue?

Yes it is still an issue. Azure devops has this error too.

@gsmet
Copy link
Member

gsmet commented Apr 13, 2021

But is your lib directory empty? That looks very suspicious. I wonder if you're not in the case where the extensions are forcing an uberjar build. Have a look at the target directory and tell us if you have a runner.jar or a quarkus-app dir.

@cmoulliard
Copy link

I also experimented this error on centos7 VM using podman.

@yurake
Copy link
Author

yurake commented Apr 21, 2021

I have the issue solved, when I upgrade Quarkus version 1.8.1-Final to 1.13.2.Final.
In Quarkus 1.12 released, Fast jar is as default, I guess target Dockerfile was changed.

$ docker build -t yurak/jaxrs-memcached-quarkus:latest -f src/main/docker/Dockerfile.jvm . 
Sending build context to Docker daemon  17.51MB
Step 1/13 : FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
 ---> 332744c1854d
Step 2/13 : ARG JAVA_PACKAGE=java-11-openjdk-headless
 ---> Using cache
 ---> 0a96242aa794
Step 3/13 : ARG RUN_JAVA_VERSION=1.3.8
 ---> Using cache
 ---> 7fe705ebf653
Step 4/13 : ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
 ---> Using cache
 ---> 589208afe623
Step 5/13 : RUN microdnf install curl ca-certificates ${JAVA_PACKAGE}     && microdnf update     && microdnf clean all     && mkdir /deployments     && chown 1001 /deployments     && chmod "g+rwX" /deployments     && chown 1001:root /deployments     && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh     && chown 1001 /deployments/run-java.sh     && chmod 540 /deployments/run-java.sh     && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security
 ---> Using cache
 ---> 51d7750660b6
Step 6/13 : ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
 ---> Using cache
 ---> b186ceb0eb1b
Step 7/13 : COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
 ---> Using cache
 ---> d259c492efc5
Step 8/13 : COPY --chown=1001 target/quarkus-app/*.jar /deployments/
 ---> Using cache
 ---> 627af8955df0
Step 9/13 : COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
 ---> Using cache
 ---> 1111f1155c12
Step 10/13 : COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
 ---> Using cache
 ---> 19c50597dbbd
Step 11/13 : EXPOSE 8080
 ---> Using cache
 ---> 822111b4ec54
Step 12/13 : USER 1001
 ---> Using cache
 ---> 926a72574169
Step 13/13 : ENTRYPOINT [ "/deployments/run-java.sh" ]
 ---> Using cache
 ---> 971ae39061bd
Successfully built 971ae39061bd
Successfully tagged yurak/jaxrs-memcached-quarkus:latest

@douglasagliardi
Copy link

An important note for those that were upgrading from 1.11 (or older) is to update the .dockerignore file accordingly to the latest version, specially when using legacy mode - as pointed out above, on 1.12 they have made the fast jar the default option and, since a new directory structure have been added (quarkus-app) we need to prevent the cleanup of this directory (and it's sub-directories) to be available during the Docker Build Context.

.dockerignore

*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*

@yurake yurake closed this as completed Jun 12, 2021
@geoand geoand added the triage/invalid This doesn't seem right label Jun 12, 2021
@mickeyjoe666
Copy link

hey! i fixed dockerignore but seems the problem not gone, could you help me?

Sending build context to Docker daemon 10.75kB Step 1/13 : FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 ---> 332744c1854d Step 2/13 : ARG JAVA_PACKAGE=java-11-openjdk-headless ---> Using cache ---> 04526731ef27 Step 3/13 : ARG RUN_JAVA_VERSION=1.3.8 ---> Using cache ---> 1a751a2fa7bd Step 4/13 : ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' ---> Using cache ---> 2120d71c5806 Step 5/13 : RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} && microdnf update && microdnf clean all && mkdir /deployments && chown 1001 /deployments && chmod "g+rwX" /deployments && chown 1001:root /deployments && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh && chown 1001 /deployments/run-java.sh && chmod 540 /deployments/run-java.sh && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security ---> Using cache ---> f58c1dcc5400 Step 6/13 : ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" ---> Using cache ---> 0dff318890ce Step 7/13 : COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ COPY failed: file not found in build context or excluded by .dockerignore: stat target/quarkus-app/lib/: file does not exist ▸ Error: docker build exited with Error: 1

@KrystianBalwierzJorsek
Copy link

I found that having
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-google-cloud-functions-http</artifactId> </dependency>
pushes build to use uber-jar always

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

9 participants