GithubHelp home page GithubHelp logo

markruys / docker-deb-builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tsaarni/docker-deb-builder

0.0 1.0 0.0 9 KB

Tutorial on how to use Docker to build Debian packages

License: MIT License

Shell 100.00%

docker-deb-builder's Introduction

Creating Debian packages in Docker container

Overview

Docker can be used to set up a clean build environment for Debian packaging. This tutorial shows how to create a container with required build tools and how to use it to build packages.

Create build environment

Start by building a container that will act as package build environment:

docker build -t docker-deb-builder:17.04 -f Dockerfile-ubuntu-17.04 .

In this example the target is Ubuntu 17.04 but you can create and modify Dockerfile-nnn to match your target environment.

Building packages

First download or git clone the source code of the package you are building:

git clone ... ~/my-package-source

The source code should contain subdirectory called debian with at least a minimum set of packaging files: control, copyright, changelog and rules.

Clone the docker-deb-builder (the repository you are reading now) and run the build script to see usage:

$ ./build
usage: build [options...] SOURCEDIR
Options:
  -i IMAGE  Name of the docker image (including tag) to use as package build environment.
  -o DIR    Destination directory to store packages to.
  -d DIR    Directory that contains other deb packages that need to be installed before build.

To build Debian packages run following commands:

# create destination directory to store the build results
mkdir output

# build package from source directory
./build -i docker-deb-builder:17.04 -o output ~/my-package-source

After successful build you will find the .deb files in output directory.

Sometimes build might require dependencies that cannot be installed with apt-get build-dep. You can install them into the build environment by passing option -d DIR where DIR is a directory with *.deb files in it.

./build -i docker-deb-builder:17.04 -o output -d dependencies ~/my-package-source

Integrating with CI

In this tutorial all package-specific build dependencies are installed from scratch each time build is executed in the container. The benefit is that the container is generic and reusable for building any package but the installation of build-time dependencies can add up to considerable overhead, both in time and bandwidth. This overhead may not be acceptable when building packages as part of continuous integration pipeline. One possible solution to reduce overhead is to install package-specific build dependencies into build environment container.

docker-deb-builder's People

Contributors

apiraino avatar markruys avatar tsaarni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.