Docker-compose build problem

creditcard-monk:
 build:
  context: ./creditcard
  dockerfile: Dockerfile
  args:
    JAR_FILE: target/creditcard-1.0.0.jar

Docker compose version 3.0. The jar_file argument is used to copy the jar-file to spring-boot jar under docker container

I get the error
failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder347176151/target/creditcard-1.0.0.jar: no such file or directory

i thought the mentioning of context ,will read jar from target folder .but it seems docker-compose is not reading the file from context specified

Please help. Note:- the docker file is simple, built from alpine-java-8 and a copy command to copy jar to container to start spring boot app

you need to COPY target within your Dockerfile into your image, otherwise it does not know your target folder.