Skip to content

Docker Hub Travis CI Workflow

Jean-Michaël Celerier edited this page Jun 3, 2016 · 9 revisions

This page explains how to build and deploy AppImages from Travis CI, using Docker.

The objective is to have a pipeline that automatically build a binary working on most recent desktop distributions, and upload it to github releases or a provider of your choice.

This tutorial assumes familiarity with the creation of AppImages.

Prerequisites

First, multiple things are required :

  • A GitHub repository with a program that you want to embed in an AppImage.
  • A Travis CI account. Travis is a continuous integration service. It provides virtual machines for open source projects that are triggered on each new commit in the GitHub repository.
  • A Docker Hub account. This optionally allows uploading pre-built Docker images, in order to reduce the build time on Travis. It is also useful if no images provide the packages you need (for instance, if you need a really recent version of GCC, Qt or Clang, or a system library with specific build options).

Creation of a Docker image

The first thing to do is to set-up your AppImage on an old system, for instance CentOS.

This can easily be done with docker :

$ docker pull centos:6
$ docker run -i -t centos:6 /bin/bash

These commands drop you to a shell running in a CentOS container. From there, you can update, install more recent packages, etc :

# yum -y update 
# yum -y install epel-release

epel-release is a repository that contains very recent versions of some packages. For instance, it provides Qt 5.6. This is useful for modern development toolchains.

Write down all the commands used to "populate" the container in a script, this is useful for rebuilding it automatically if more updates come down the pipeline. For instance :

Recipe.deps

#!/bin/bash -eux 

yum -y install epel-release
yum -y update 
yum -y install qt5-qtbase-devel gcc gcc-c++

[ ... git clone AppImage, AppImageKit, etc. ...]

Then, write your AppImage recipe and try it on the container (and try to build to to check that everything works !). The recipe ends by creating the AppImage : once it is run, there should be a folder with YourSoftware.AppImage somewhere.

Recipe

#!/bin/bash -eux

git clone https://github.com/my/software
cmake, etc...

Examples of recipes : https://github.com/probonopd/AppImages/tree/master/recipes

Finally, we create a Docker file that explains how to build the image :

Dockerfile

FROM centos:6

ADD Recipe.deps /Recipe.deps
RUN bash -ex Recipe.deps 

ADD Recipe /Recipe
RUN bash -ex Recipe

Once the container provides all the libraries & things needed for building your software, you can save it from the host :

$ docker commit <container-id> <the-name>

You can see the container id with docker ps

The docker container can then be uploaded to

Clone this wiki locally