antwebsphere-libertyubi

How to install Apache Ant during docker image build from UBI


Trying to use ibmcom/websphere-liberty:full-java8-ibmjava-ubi (RHEL8.2) as a builder image and trying to install ant but no success

[root@d68aa2dcc111 /]# yum -y install ant
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:26:00 ago on Tue Aug 25 21:01:43 2020.
No match for argument: ant
Error: Unable to find a match: ant```

Solution

  • You can install getting the binary via 'wget' with:

    ENV ANT_VERSION=1.10.8
    RUN wget http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \
        && tar xvfvz apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt \
        && ln -sfn /opt/apache-ant-${ANT_VERSION} /opt/ant \
        && sh -c 'echo ANT_HOME=/opt/ant >> /etc/environment' \
        && ln -sfn /opt/ant/bin/ant /usr/bin/ant \
        && rm apache-ant-${ANT_VERSION}-bin.tar.gz