Skip to main content

Build Docker images with custom packages for local development, testing and daily tasks.

Project description

Build Docker images with custom packages

Install vim and curl using apt-get.

docker run -it --rm $(dugaire build -apt=vim,curl)

Install vim, python3, pip3 using apt-get and install ansible using pip3.

docker run -it --rm $(dugaire build -apt=vim,python3-pip -pip3=ansible)

Install kubectl binary version v1.15.0 (use --with-kubectl=latest to install the latest version).

docker run -it --rm $(dugaire build -apt=vim --with-kubectl=1.15.0)

Install (on Linux)

Clone this repository.

git clone https://github.com/tadeugr/dugaire.git

cd to its directory.

cd dugaire

Install it (pip3 is a requirement).

make install

You should have the command available.

dugaire build --help

Usage

Usage: dugaire build [OPTIONS]

  Build Docker images with custom packages.

  Examples:

  Build an image and install vim and curl using apt-get.

  $ dugaire build -apt=vim,curl

  Build an image and install python3 using apt-get and ansible using pip3.

  $ dugaire build -apt=python3-pip -pip3=ansible

  Build an image and install the latest version of kubectl.

  $ dugaire build --with-kubectl=latest

Options:
  -apt, --apt-install TEXT        Comma separeted list of packages (no blank
                                  space) to install using apt-get install.
                                  Example: -apt=curl,vim

  -pip3, --pip3-install TEXT      Comma separeted list of packages (no blank
                                  space) to install using pip3 install.
                                  WARNING: requires -apt=python3-pip. Example:
                                  -apt=python3-pip -pip3=ansible,jinja2

  --with-kubectl TEXT             Install kubectl version. Examples: --with-
                                  kubectl=latest / --with-kubectl=1.17.0

  -n, --name TEXT                 Image name.  [default: random]
  --dry-run                       Do not build image.  [default: False]
  -o, --output [image-id|image-name|dockerfile]
                                  Command output options.  [default: image-id]
  --help                          Show this message and exit.

Supported features

Base images

  • ubuntu:18.04

Package/Dependency managers

  • apt-get: you can install any package using apt. Use a comma separated (no blank space) list of packages you want to install. Example: -apt=wget,iputils-ping

  • pip3: you can install any package using pip3. Use a comma separated (no blank space) list of packages you want to install. Example: -pip3=jinja2,pyyaml. WARNING to use pip3 you must explicitly install pip3 using apt: -apt=python3-pip.

Packages

  • kubectl: use the parameter --with-kubectl=latest to install the latest version. For specific versions use the following format: --with-kubectl=1.17.0

Useful commands

List images generated by dugaire

docker images -f label='builtwith=dugaire'

Known issues

RuntimeError: Python 3 was configured to use ASCII as encoding for the environment

If you get an error like this one:

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/python3/ for mitigation steps.

It is because dugaire uses Python3 and Click, and according to Click "in Python 3, the encoding detection is done in the interpreter, and on Linux and certain other operating systems, its encoding handling is problematic". Read more.

Solution

Setup your locale correctly, for example if you are using en_US.UTF-8, run:

apt update && apt-get -y install locales
locale-gen --purge en_US.UTF-8

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

# Alternatively you can run: 
#sudo dpkg-reconfigure locales

Then you should be able to run dugaire.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dugaire-0.0.2.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

dugaire-0.0.2-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page