Quarkus: A multi-stage Docker build, error COPY --from=build /usr/src/app/target/*-runner /work/application

Created on 7 Apr 2020  路  8Comments  路  Source: quarkusio/quarkus

Describe the bug
When I try to make a multi-stage Docker build, on stage 2 i get an exception:

DockerFile.multistage
COPY --from=build /usr/src/app/target/*-runner /work/application
-> COPY failed: no source files were specified

Expected behavior
build succeeded
Actual behavior
COPY failed: no source files were specified

To Reproduce
Steps to reproduce the behavior:

  1. build docker

Configuration

## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:19.2.1 AS build
WORKDIR /usr/src/app
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus


COPY settings.xml /home/quarkus/.m2
COPY settings-security.xml /home/quarkus/.m2

RUN mvn -f /usr/src/app/pom.xml -Pnative clean package

FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=build /usr/src/app/target/*-runner /work/application
RUN chmod 775 /work
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

kinquestion

Most helpful comment

I'm not on Mac either :P

All 8 comments

I am assuming you tried to follow: https://quarkus.io/guides/building-native-image#creating-a-container-with-a-multi-stage-docker-build

If so, have you followed this:

Before launching our Docker build, we need to update the default .dockerignore file as it filters everything except the target directory and as we plan to build inside a container we need to be able to copy the src directory. So edit your .dockerignore and remove or comment its content.

?

I am assuming you tried to follow: https://quarkus.io/guides/building-native-image#creating-a-container-with-a-multi-stage-docker-build

If so, have you followed this:

Before launching our Docker build, we need to update the default .dockerignore file as it filters everything except the target directory and as we plan to build inside a container we need to be able to copy the src directory. So edit your .dockerignore and remove or comment its content.

?

Yes I did

I tried the process and it works.

Can you perhaps upload a reproducer which demonstrates the failure?

Sure

I tried the process and it works.

Can you perhaps upload a reproducer which demonstrates the failure?

Sure: https://gyazo.com/c410aac0e9c45d9ca37e406bbb4c884c
I Use Java11, Windows10, Docker Desktop installation.
Quarkus 1.3.0 final

Tried on mac, got the same error.
Mac Majove, OpenJDK11, Quarkus 1.3.0 Final and Docker Desktop

Thanks.

I am not on Windows so I can't really test that setup. Hopefully someone else will be able to.

Thanks.

I am not on Windows so I can't really test that setup. Hopefully someone else will be able to.

It happens also on Mac

I'm not on Mac either :P

haha okay thanks btw :)

Was this page helpful?
0 / 5 - 0 ratings