Using gbp-buildpackage in a Docker way
23 Feb 2026To build a package on Debian, I was always using my server called “atom” (more on it in later posts). With Debian stable installed, I can build packages for Debian Sid as intended. My favourite way was to use pbuilder for most packages and sbuild for heavier software. It is fast and reliable, without having to spin up a standalone isolated virtual machine.
Sometimes you are not able to use a server, or it is not convenient. It is easier to spin up a Docker container to build a package or introduce a small fix. That’s why I wrote a small automation around Docker and gbp.
It is available in my GitHub repo. The main idea is to build a prebaked image with all the required tools. The user launches a container. Inside it, package-specific build dependencies are installed, gbp buildpackage is executed with post-build checks, lints are run, the package is optionally signed with GPG, and then the container exits. So it allows you to boil down the whole process to a single line:
docker compose run --rm debian --workdir /workspace/asn1c
All the sources are in the host machine’s directory (so I can easily edit them with my favourite editor) and the build artefacts (.dsc, .build, and .changes files) are placed in the same /workspace directory. No copying, no rsyncing. Feel free to use!
Also, the modern Debian infrastructure in SalsaCI builds and tests packages for you via familiar GitLab CI. It’s a slightly longer feedback loop and is well-suited for a final check. I prefer iterating fast with local builds.
That said, I tested this suite while maintaining two new versions of my packages, which recently landed in Debian testing:
- asn1c 0.9.28+dfsg-6. It includes fixes to man pages and fonts, new standards, and general cleanup
- pstreams 1.0.4-2. It’s a new upstream version, with new Debian standards and build tweaks.