This repository contains all base Dockerfiles for Docker that I used, published to Docker registry.
- oracle-java: Base image with Oracle JDK, providing versions for java 6, 7 and 8. Additionally, updates Java Cryptography Extension (JCE).
- maven: Base image with Apache Maven, providing versions for java 7 and 8.
- tomcat: Base image with Apache Tomcat, providing versions with Oracle JDK 7 and 8.
- wildfly: Base image with JBoss WildFly, providing versions with Oracle JDK 7 and 8.
- jboss-as: Base image with old versions of JBoss Application Server, providing versions for families 4.X and 5.X.
- mule-esb: Docker Image packaging for MuleESB with Oracle JDK 7.
- grunt: Debian Jessie based image with NodeJS, Grunt and Bower installed.
This section cover information to anyone who may contribute to this project, or wants to tweak it for its own uses.
For maintainability some base images are created using templates. Usually some images have multiple versions, e.g. based in major releases or OS-based images (Debian/Alpine). The Dockerfiles for different versions of an image, most of the time, are basically the same. Most common variables are product and dependency versions. Thus, it is really error prone manually modify many similar files. For those cases docker-template is used.
Docker-template is a utility tool written in Ruby that allows writing Dockerfiles using ERB templates. It also uses a opts.yml file to describe all variables for substitution. It is meant for deploying images right from templates, without saving it. Therefore, it usually does not keep generated Dockerfiles. We do keep these generated files, so we wrapped it up with a update-dockerfile.sh script. The script uses docker-template cache and docker-template list outputs to generate and update project files.
As described earlier, the update-dockerfile.sh script depends on docker-template. Docker-template requires Ruby 2.1+. So, firstly you need Ruby 2.1+ up and running in your system. The update script supports calling docker template through both docker-template and bundler exec docker-template. Therefore, there is two ways of installing to have docker-template installed, once you have ruby in your system.
- Use the
Gemfileprovided and install via Bundler and it should be available to you throughbundler exec docker-template.
# install bundler system-wide, if not installed yet
sudo gem install bundler
# install ruby dependencies in this project (docker-template)
bundler install- Install through rubygems and it will be available system-wide through
docker-template
sudo gem install docker-templateImportant: Docker template 0.9.0+ is required. As 2016-07-27, it has not been released in rubygems. Installation through
bundler, pointing to projectmasterbranch, is required to this project work. Once version 0.9.0 is released, system-wide installation throughgem installwill work as well.
For reference how to use docker-template visit its wiki and this 2 example projects: jekyll-docker and envygeeks-docker.
Following the docker-template schema, templates are located into /repos/[image] directory in this repository. The /opts.yml holds configurations applied to all images, like maintainer, or used in FROM directive (docker-template limitation). Each image, repository in docker-template lingo, has the following files under /repos/[image]:
Dockerfile: ERB-templated dockerfile.opts.yml: Image specific configurations.README.md: Image README without the "Supported versions and tags" section. (extension of this project)
Example:
~/projects/andreptb-dockerfiles $ ls -lhR repos/tomcat
repos/tomcat:
total 36K
-rw-rw-r-- 1 user user 2,8K Jul 22 15:50 Dockerfile
-rw-rw-r-- 1 user user 619 Jul 22 15:50 opts.yml
-rw-rw-r-- 1 user user 3,9K Jul 22 15:50 README.mdExecuting update-dockerfile.sh, it will create a /[image] directory within the repository root folder for each image inside /repos/[image]. This image folder will contain:
- a
README.mdgenerated from/repos/[image]/README.md, inserting a section of all tags (versions) provided (with links) on its top. - a folder per
taginopts.ymlwith:- a symlink to the image's
README.md - a plain
Dockerfile
- a symlink to the image's
Example:
~/projects/andreptb-dockerfiles $ ls -lhR tomcat
tomcat:
total 40K
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 6-jdk6
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 6-jdk7
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 7-jdk7
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 7-jdk8
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 8-jdk7
drwxrwxr-x 2 user user 4,0K Jul 22 15:50 8-jdk8
-rw-rw-r-- 1 user user 4,7K Jul 22 15:50 README.md
tomcat/6-jdk6:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.md
tomcat/6-jdk7:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.md
tomcat/7-jdk7:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.md
tomcat/7-jdk8:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.md
tomcat/8-jdk7:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.md
tomcat/8-jdk8:
total 16K
-rw-rw-r-- 1 user user 2,7K Jul 22 15:50 Dockerfile
lrwxrwxrwx 1 user user 12 Jul 22 15:50 README.md -> ../README.mdThe script supports update all images or a list of given ones.
# update all images/repositories in docker-template lingo
./update-dockerfile.sh
# update only tomcat image
./update-dockerfile.sh tomcat
# update tomcat and oracle-java images
./update-dockerfile.sh tomcat oracle-javaUses ./update-dockerfile.sh --help for usage.