Configuring the GitHub Action to build a image of this project I am getting this error:
Step 5/7 : COPY /target/*.jar app.jar
COPY failed: no source files were specified
This is the project Dockerfile, and I am referencing the file from build context path, not from relative path.
FROM openjdk:8-jdk-alpine as build
COPY . /usr/app
WORKDIR /usr/app
RUN chmod +x mvnw \
&& ./mvnw --version \
&& ./mvnw clean package
COPY /usr/app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]
I already verified if the file exist and read permissions with ls -l /target command:
drwxr-xr-x 3 root root 4096 Oct 18 15:35 classes
drwxr-xr-x 3 root root 4096 Oct 18 15:35 generated-sources
drwxr-xr-x 3 root root 4096 Oct 18 15:35 generated-test-sources
-rw-r--r-- 1 root root 48625321 Oct 18 15:35 learning-spring-boot-0.0.1.jar
-rw-r--r-- 1 root root 33089 Oct 18 15:35 learning-spring-boot-0.0.1.jar.original
drwxr-xr-x 2 root root 4096 Oct 18 15:35 maven-archiver
drwxr-xr-x 3 root root 4096 Oct 18 15:35 maven-status
drwxr-xr-x 2 root root 4096 Oct 18 15:35 surefire-reports
drwxr-xr-x 3 root root 4096 Oct 18 15:35 test-classes
And this is the output with find . after the ./mvnw clean package command:
./target/learning-spring-boot-0.0.1.jar
./target/maven-archiver
./target/maven-archiver/pom.properties
./target/generated-sources
./target/generated-sources/annotations
./target/surefire-reports
Locally runs using the relative path, but fails with path from build context.
COPY /target/*.jar app.jar
Here is the project url.
What I am missing?
app.jarcommitted and in the git repo with the correct permissions? Try building locally on a fresh clone of the repo.