Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Bleeding Edge on Docker

DZone's Guide to

Bleeding Edge on Docker

Infinispan Docker images are usually published with their release, but what do you do if you want to try out some brand new features which have just been merged? Read on to find out how to handle this.

· DevOps Zone
Free Resource

“Automated Testing: The Glue That Holds DevOps Together” to learn about the key role automated testing plays in a DevOps workflow, brought to you in partnership with Sauce Labs.

As you may have noticed, at Infinispan our Docker images are published together with (or very soon after) releases. But what if you want to try out some brand new features which have just been merged? In that case, you need to build an image by yourself.

Step #1 - Clone JBoss Docker Image Repository

At first, you will need to clone our Infinispan Docker images:

git clone https://github.com/jboss-dockerfiles/infinispan.git
cd infinispan

Step #2 - Build or Download the Latest SNAPSHOT

There are two options here—you can build the distribution yourself or use SNAPSHOTs available on JBoss Nexus repository.

The first option requires checking out the Infinispan source code and performing a Maven build:

git clone https://github.com/infinispan/infinispan.git
cd infinispan
mvn clean install -DskipTests

The second one is much simpler (Infinispan SNAPSHOTs are pushed into the repository after each successful build:

wget -L "https://repository.jboss.org/nexus/service/local/artifact/maven/redirect?r=snapshots&g=org.infinispan.server&a=infinispan-server-build&v=9.0.0-SNAPSHOT&e=zip"

Step #3 - Building Infinispan Docker Image

One of the steps for building Infinispan Docker image is to download the distribution from the  Infinispan Download page. We need to slightly modify this step and use our manually downloaded packages.

Modify the Dockerfile as shown below:

#Replace this line:
RUN INFINISPAN_SHA=$(curl $DISTRIBUTION_URL.sha1); curl -o /tmp/server.zip $DISTRIBUTION_URL && sha1sum /tmp/server.zip | grep $INFINISPAN_SHA \
  && unzip -q /tmp/server.zip -d $HOME && mv $HOME/infinispan-server-* $HOME/infinispan-server && rm /tmp/server.zip

#With this:
USER root
ADD infinispan-server-9.0.0-SNAPSHOT /opt/jboss/infinispan-server
#Since we are playing with development versions, we don't care about the permissions
RUN  chmod -R 777 /opt/jboss/infinispan-server
RUN  chmod +x /opt/jboss/infinispan-server/bin/*.sh
USER jboss

Now you are ready to invoke the Docker build:

docker build -t infinispan-server .

Conclusion

As you can see building a SNAPSHOT based docker image is very simple. From my own experience I can tell you that pushing it into Docker Hub is the fastest way to start playing with it in any PaaS environment (e.g. Openshift Online)

Happy building!

Learn about the importance of automated testing as part of a healthy DevOps practice, brought to you in partnership with Sauce Labs.

Topics:
infinispan ,merge ,build ,docker ,image

Published at DZone with permission of Sebastian Laskawiec. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}