Building deb Package Using Docker
While you can build deb packages by installing the necessary requirements and running the commands on your local machine, I prefer not to as it litters the system with random dev packages.
In the past, I used a debootstrab schroot. But that’s a ton of configuration steps that can be easily avoided by using Docker!
Assuming you have Docker already installed…
(make sure your user is in the docker
group)
First, install the debocker
package. It’s a helper tool to run all the
necessary commands.
Next, download the sources you need (dsc, orig.tar.gz, debian.tar.xz, etc) for
your package. In my case, I wanted to build the latest experimental yosys
for 18.04.
$ cd testbuild
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/y/yosys/yosys_0.8-1build1.dsc
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/y/yosys/yosys_0.8.orig.tar.gz
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/y/yosys/yosys_0.8-1build1.debian.tar.xz
$ dpkg-source -x yosys_0.8-1build1.dsc
$ cd yosys-0.8
# may need to fix the debian/changelog file
$ debocker build --image ubuntu:18.04
Assuming everything went okay, you should have a bunch of .deb
files built!