Build your own Docker image - custom openhab build

Currently there seems to be an issue with the build server and I wanted access to a recent build of openhab. So I created my own docker image pointing to a particular build of openhab-distribution by overriding the Dockerfile for the openhab-docker project. Here how you could do something similar.

First, let’s get a copy of the docker project

git clone https://github.com/openhab/openhab-docker.git

cd opehab-docker

Now you have to decide which version of Openhab you are interested in using

cd 2.1.0-snapshot/

Now pick the architecture you want for the docker image (eg. amd64 or arm for pi’s)

cd amd64/

Now we must modify the Dockerfile so that we can point to a specific build (in this case I used build 836 instead of the last successful build. Use the editor of your choice, you should end up with lines as below.

#ENV OPENHAB_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-2.1.0-SNAPSHOT.zip"Ni
ENV OPENHAB_URL="https://openhab.ci.cloudbees.com/job/openHAB-Distribution/836/artifact/distributions/openhab/target/openhab-2.1.0-SNAPSHOT.zip"

Now we are ready to build the docker image

docker build -t openhab/openhab:mycustom-build .

Notice I decided to leave the name of the image as openhab/openhab and just put a label to denote my custom build.

Now you can run this image according to the instructions for the regular docker image, just make sure you change the label to what you built.

2 Likes

FYI.

Not sure this anymore. cloudbees doesn’t seem to be keeping any history build artifacts anymore.