0

I have a Java Maven application which I used to be able to successfully build with a dockerfile but somehow now it does not work and gives me this exception:

 > [14/14] COPY acs/target/dependency/ /src/lib:
------
failed to compute cache key: "/acs/target/dependency" not found: not found

Here is my Dockerfile:

#Required
FROM eclipse-temurin:16

# The jar file that will be run. This is a result of the build process
ARG JAR_FILE=target/*.jar

# The dependencies folder for all maven dependencies
ARG DEPENDENCIES=target/dependency/

# Make a directory for the jar
RUN mkdir /src

# Make a directory for the dependencies
RUN mkdir /src/lib

RUN echo "$PWD"

#Make a directoryfor the ServerConfig file 
RUN mkdir -p /src/main/resources
#Echo Jar File
RUN echo $JAR_FILE

# Copy the jar from it's original location to the docker container
COPY acs/${JAR_FILE} /src/jar/
#Echo Jar File
RUN echo $(ls -1 /src/jar/)


RUN echo pwd

# Copy all of the dependencies of the jar to the docker container
COPY acs/${DEPENDENCIES} /src/lib

# The entry point is the command the docker container will run when it start, so in this case it will start the jar
ENTRYPOINT ["java","-jar","/src/jar/acs-latest.jar"]

Could you tell me why this happens?

David Maze
  • 130,717
  • 29
  • 175
  • 215
Angel Hadzhiev
  • 664
  • 2
  • 6
  • 20
  • That error says to me that some `acs/target/something.jar` file exists on the host, but there is not an `acs/target/dependency/` directory (both relative to the directory argument of `docker build`, frequently the directory containing the Dockerfile). Do you need to run some sort of build step outside of Docker? – David Maze Apr 02 '22 at 13:48
  • Well, no. It is supposed to work just like that. @DavidMaze – Angel Hadzhiev Apr 02 '22 at 13:52

0 Answers0