How To Build an Alpine-based Virgo 3.7.0.RELEASE Container

A few weeks ago Virgo 3.7.0.RELEASE has been shipped.

Let's give it a try:

We start with an interactive Alpine Linux base openjdk image (at the time of writing openjdk:8u121-jre-alpine):

$ docker run -it --rm openjdk:8u121-jre-alpine /bin/sh

Install curl and bsdtar into the Java Alpine Linux container:

/ # apk update
/ # apk add curl libarchive-tools

Create the destination user and directory then grab version 3.7.0.RELEASE from Virgo Releases:

/ # adduser -D virgo
/ # su virgo
/ $ curl -L 'https://www.eclipse.org/downloads/download.php?file=/virgo/release/VP/3.7.0.RELEASE/virgo-tomcat-server-3.7.0.RELEASE.zip&mirror_id=580&r=1' | bsdtar --strip-components 1 -C /home/virgo -xzf -

Since Virgo startup scripts depend on bash we need to add the shell before we can run Virgo:

/ # apk add bash

/ $ chmod u+x /home/virgo/bin/*sh
/ $ /home/virgo/bin/startup.sh
....
[2017-04-07 18:53:51.772] sync Event Dispatcher Thread <UR0001I> User region ready.
[2017-04-07 18:53:51.824] startup-readiness            <KE0007I> Virgo ready. Started for 22.449s.
....

Looks good.

This interactive experiment results in the following basic Dockerfile:

FROM 8u121-jre-alpine

RUN apk update
RUN apk add curl libarchive-tools
RUN apk add bash

RUN adduser -D virgo
RUN curl -L http://www.eclipse.org/downloads/download.php?file=/virgo/release/VP/3.7.0.RELEASE/virgo-tomcat-server-3.7.0.RELEASE.zip&mirror_id=580&r=1

RUN chmod u+x /home/virgo/bin/*sh
RUN chown -R virgo:virgo /home/virgo

EXPOSE 8080

USER virgo
CMD ["/home/virgo/bin/startup.sh"]

Have fun with your dockerized Virgo...