Nadeesha De Silva
Nadeesha De Silva

Reputation: 11

Getting error - 'build.xml does not exist' when building docker file which contains docker commands to run ant targets

I am creating a docker file to run an ant target which is written in build.xml

My docker file contains below lines.

FROM frekele/ant:1.10.1-jdk8

RUN ant -f ./build.xml all

Then, I am building docker file from command prompt as below,

D:\Support\containarization\cont-new-withfuncactinput\workspace\bas\source\bas\framework\cn\connect_framework> docker build -f ./Dockerfile ./connect-build -t test/connect-build

My build.xml and docker file both are located in same above location.

File Structure,

D:\Support\containarization\cont-new-withfuncactinput\workspace\bas\source\bas\framework\cn\connect_framework

 - Dockerfile
 - build.xml

But, I am getting below error when building docker

Buildfile: ./build.xml does not exist!

How can I solve this.

Upvotes: 0

Views: 946

Answers (1)

Zeitounator
Zeitounator

Reputation: 44799

You need to push the file to your image before running ant else it does not exist there. You have to use COPY for this

Try to modify your Docker file like the following and it should fix your current problem:

FROM frekele/ant:1.10.1-jdk8
COPY build.xml ./build.xml
RUN ant -f ./build.xml all

Upvotes: 1

Related Questions