Note: AppImager is a work in progress. All contributions and suggestions are much appreciated.
AppImager is a CLI tool for creating and managing AppImages.
It has the ability to manage application dependences, setup an AppDir and package that AppDir into an AppImage.
Icon made by Darius Dan from www.flaticon.com is licensed by CC 3.0 BY
AppImages are an amazing way to distribute apps on almost any Linux distribution, but the way these apps have to be packaged is a bit convoluted, requiring you to build your app on an old base system, and figure out which dependencies are probably part of the base system, and which should be packaged into your AppImage.
AppImager is designed to help with this. It creates a Docker container with an Ubuntu base system at a version of your choice where you can download the dependencies you need for your app, and extract them into your AppDir.
We do this by using an AppImage.yml file to specify the dependencies required to compile the app, and the dependencies required to run it. AppImager then reads this YAML file, downloads and decompresses the dependencies into the AppDir, then compiles and packages your app into an AppImage.
The goal is to be able to add one AppImage.yml file alongside your source code, then use AppImager to build your app into an AppImage with no additional work required and no complicated scripts to be written.
Below is an example of an AppImage.yml file.
name: AppImager
description: AppImager manages AppImage dependencies, assists in the creation of AppDir's and creates AppImages from source code
build: cmake . && make clean && make
base: 12.04
env:
MY_ENV_VAR: environment variable
repositories:
- "ppa:ubuntu-toolchain-r/test"
- "deb http://gb.archive.ubuntu.com/ubuntu/ precise universe multiverse"
require:
- fuse
- zlib
require_build:
- cmake
- binutils
- glibc
- glib2
- gcc
AppImager works from an AppImage.yml file. This file tells AppImager numerous things about your app and the environment you want to compile it in.
The name of your app.
The description of your app.
This is the command that is run to compile your app. Usually this will be the path to a bash script which compiles your app.
The command/script specified here will be called when running ./appimager build
. It should compile your app into the build
directory.
The base Ubuntu version you want to target. To support a larger number of systems and distros then we recommend setting this to the oldest currently supported version of Ubuntu (12.04 at the time of writing).
We use Ubuntu as our base as it has multiple supported versions available, which gives you the flexibility of either supporting many systems, or using the latest libraries.
Although we use Ubuntu for our build environment, the compiled apps you create will work on almost any relatively recent Linux distribution.
This is a list of dependencies that will be included in your AppImage. This should be a list of packages that are assumed to not be included on every system you want to target.
Note: Dependencies for these packages will not be resolved automatically, so you will need to include all dependencies to be included in your AppImage
This is a list of dependencies that are required to build/compile your app (e.g. gcc), but are not needed once your app is compiled and packaged.
Note: These packages are installed directly into the container using apt-get. Dependencies for these packages will be resolved automatically.
- cmake
- binutils
- docker
- fuse
- glibc
- glib2
- gcc
- zlib
- xorriso
sudo yum install cmake binutils docker fuse glibc-devel glib2-devel gcc zlib xorriso # Fedora 23
cmake .
make clean
make
Once you have compiled the runtime binary, you can then start using AppImager. Most of the AppImager commands are based around your current working directory (we call this the environment). Your working directroy should be the directory which contains your AppImage.yml file.
The setup
command creates a Docker container with a base Ubuntu installation to a version you specify in your AppImage.yml file and install the build dependencies. AppImager will then use this container to compile your app.
./appimager setup
The install
command reads the AppImage.yml file in the current working directory and downloads and extracts the dependencies into your build directory.
./appimager install
The build
command runs the build command/script specified in your AppImage.yml file.
./appimager build
The start
command starts the container for the current environment.
./appimager start
The stop
command stops the container for the current environment.
./appimager stop
The status
command shows the current status of the container for this environment.
./appimager status
The package
command packages the AppDir (build directory) into an AppImage, ready for distribution.
./appimager package
The destroy
command stops and destroys/deletes the container for this environment.
./appimager destroy