Reputation: 23
I'm a newbie with docker.
I'm creating a dockerfile, and want to execute hello world from Ant file "build.xml" with docker commands. Is this possible?
Upvotes: 0
Views: 5716
Reputation: 1493
@Mihai's answer seems right but there was something I needed to add because I got an error like this:
> [3/3] RUN apk update && apk add openjdk8 && apk add apache-ant:
#6 0.239 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
#6 0.482 139776850742088:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1913:
#6 0.484 ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.13/main: Permission denied
#6 0.484 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: No such file or directory
I had to do what I saw in this answer.
repositories
file with these contents:
http://dl-cdn.alpinelinux.org/alpine/v3.13/main
http://dl-cdn.alpinelinux.org/alpine/v3.13/community
Dockerfile
before the RUN apk update
add the following:
COPY repositories /etc/apk/repositories
Upvotes: 0
Reputation: 10757
This is a quick solution:
FROM alpine
WORKDIR /work
RUN apk update && apk add openjdk8 && apk add apache-ant
ENTRYPOINT [ "ant" ]
<?xml version = "1.0"?>
<project name = "Hello World Project" default = "info">
<target name = "info">
<echo>Hello World - Welcome to Apache Ant!</echo>
</target>
</project>
docker build -t ant:1.0 ./ant
docker run --rm -v $(pwd)/ant:/work ant:1.0
Of course you can put in "ant" your whole project and build that.
This can be refined, but hopefully it answers your question so far.
Upvotes: 3