This image provides a development image based around Ubuntu 16.04. This container is big on purpose. This is due to it having all the utilities required to compile either Java or C/C++ applications already installed within it.

It has autoconf, automake, GCC & Java 8 installed along with the following source control systems installed: cvs, git, mercurial, subversion

Important Notice

This is for development purposes only i.e. to allow you to build and package an application, library etc but not for deployment.

What you should do is use this image to perform the build, package them and submit to some repository. Then in a separate Dockerfile you build a fresh minimal image which then installs the result of the build into that container.

Usage

The following instructions are for the area51/ubuntu-dev but they equally apply to the other -dev images, area51/alpine-dev and area51/debian-dev just substitute the appropriate image names.

There's three modes of operation: Jenkins slave, as a dynamically provisioned image with the Cloudbees docker custom build environment plugin to Jenkins or as a NetBeans Build Host.

Jenkins Slave

As the -dev images provide their own sshd daemon you can use them as traditional SSH slaves to jenkins.

Simply follow the instructions for area51/jenkins-slave to configure it in Jenkins.

Cloudbees docker custom build environment plugin

The CloudBees Docker Custom Build Environment Plugin allows Jenkins to dynamically provision docker containers as part of a job.

To utilise the -dev images with this plugin, for the job you want to run:

  1. under Build Environment select Build inside a Docker container'
  2. In the newly expanded section select Pull docker image from repository
  3. In the Image id/tag field enter the image, e.g. area51/ubuntu-dev
  4. Select Advanced
  5. Clear the Container start command field - this is essential as the container already has a command.
  6. In Network bridge leave it as bridge (unless you have configured an alternate docker network to use)

That's it. Now when the job runs, when each build step is invoked the plugin will create a new docker container, run the step in that container and then remove it.

Now that last fact is important. Don't think it's neater to split up a build step and expect the environment to be the same as it won't be, it will be a new container so any changes made to the environment, installed libraries etc will not survive from one step to another.

Note: Jenkins will ensure that the current directory when the step begins is the root of the job you are running.

NetBeans Build Host

If you install the C/C++ plugins into NetBeans IDE 8.1 you can tell NetBeans to use a remote host to build under and these images can act as such a host.

Known Issues

Right now only area51/ubuntu-dev supports this fully whilst area51/debian-dev does work but can have the occasional issue.

area51/alpine-dev currently does not support NetBeans.

Now this is an issue within how NetBeans connects to the slave and not the slave itself and the cause is still under investigation.

Installation

Presuming you have the slave running on the local host, run it as follows:

# docker run -d --name=ubuntu-dev \
   -v /home/myusername/NetBeansProjects:/opt/netbeans \
   area51/ubuntu-dev
# docker inspect --format '{{ .NetworkSettings.IPAddress }}' ubuntu-dev
172.17.0.4

where myusername is your username and NetBeansProjects is the base directory of where your projects are on the host machine.

Next get in NetBeans under the services tab right-click 'C/C++ Build Hosts and select new build host.

  1. In hostname enter the IP address above then Next
  2. In Login enter jenkins then Next
  3. When the authentication dialog appears enter the password jenkins, select Remember Password then Ok
  4. When the final summary page appears select Finish.

Now you should see a new entry under C/C++ Build Hosts for jenkins@172.17.0.14. Right click that entry and select Path Mapper.

  1. Under Local Path enter /home/myusername/NetBeansProjects or the equivalent above
  2. Under Remote Path enter /opt/netbeans
  3. Select OK

Now to compile a C/C++ Project against that container in the project properties just select that host as the Build Host.

Recipes

These recipes are for area51/ubuntu-dev only. Refer to the other images for appropriate recipes for those containers.

This is a simple build step to build a C application

autoconf
./configure
make clean all
curl -T build/*.deb http://fileserver.mde.area51.onl/packages/dists/$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2 -d'=')/main/binary-amd64/

Install additional libraries then perform a build - remember this only applies to the lifetime of this single build step, it will not persist

sudo apt-get install libarea51
autoconf
./configure
make clean all

Add a trusted local apt repository then build - remember this only applies to the lifetime of this single build step, it will not persist

echo "deb [trusted=yes] http://myrepo.example/packages $(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2 -d'=') main" | sudo tee /etc/apt/sources.list.d/myrepo.list</nowiki>
sudo apt-get update
sudo apt-get install libarea51
autoconf
./configure
make clean all

Build a C application then deploy a .deb file to a remote server as an HTTP PUSH (no authentication shown)

autoconf
./configure
make clean all
curl -T build/*.deb http://myhost.example/packages/dists/$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2 -d'=')/main/binary-amd64/

Here the $(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2 -d'=') will return the ubuntu name for the distribution, xenial for the current image.