dockerdocker-composedockerfilepom.xmltestng.xml

Dockerfile unable to copy testng.xml file to docker image


I have springrestapi project setup in my local with Dockerfile and docker-compose.yml file successfully running. Now I have added my api tests as part of this project inside the same repository by adding a new directory called in-memory-tests.

in-memory-tests directory has Dockerfile in it. This Dockerfile has commands to copy to image. when i run docker-compose.yml file. its giving below error.

[+] Running 0/1 ⠿ testserv1 Error 5.1s [+] Building 3.1s (8/10) => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 34B 0.0s => [internal] load metadata for docker.io/library/maven:3.6.0-jdk-8-alpine 3.0s => CACHED [1/6] FROM docker.io/library/maven:3.6.0-jdk-8-alpine@sha256:c1439df43e994b9df98063458e704384b85914c8bef4c1de22f992f51dcc2d79 0.0s => [internal] load build context 0.0s => => transferring context: 879B 0.0s => CACHED [2/6] COPY src /app/src 0.0s => ERROR [3/6] COPY testng.xml /app/ 0.0s => ERROR [4/6] COPY reports/testreport.html /app/reports/ 0.0s

[3/6] COPY testng.xml /app/:



[4/6] COPY reports/testreport.html /app/reports/:


failed to solve: failed to compute cache key: "/reports/testreport.html" not found: not found

enter image description here Github repo link

2: [enter image description here] 2https://github.com/aamirsuhailo1/SpringRestAPIsOnDocker/tree/testframework_addition

enter image description here


Solution

  • Got resolved after adding context: ./in-memory-tests/ and removing dockerfile: in-memory-tests/Dockerfile