Skip to content

bitsbeats/drone-docker-matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drone-docker-matrix

This is a Drone plugin to build a lot of Docker images.

Usage

Plugin configuration

  • PLUGIN_REGISTRY: Registry to upload the image to. (required)
  • PLUGIN_DEFAULT_NAMESPACE: Namespace to use if not specified in docker-matrix.yml (default: images).
  • PLUGIN_BUILD_POOL_SIZE: Number of parallel Docker builds (default: 4).
  • PLUGIN_UPLOAD_POOL_SIZE: Number of parallel Docker uploads (default: 4).
  • PLUGIN_TAG_NAME: Tag Name (default: latest).
  • PLUGIN_TAG_BUILD_ID: Build id, generates tag and tag-b<build_id> for each tag; skipped if empty (default empty).
  • PLUGIN_SKIP_UPLOAD: Skip upload to registries, useful for testing (default false)

NOTE: For values in PLUGIN_TAG_NAME and PLUGIN_TAG_ID one may choose to use environment variables. Substition is handled by drone/envsubst

Repository data

The subdirectories are the image names.

puppet
puppet/Dockerfile
puppet/Gemfile

python
python/Dockerfile

php/
php/docker-matrix.yml
php/Dockerfile

[...]

The puppet and the python image are build as they are. The php image will get the special matrix treatment.

Matrixfile

  • multiply options will get multiplied with each other (optional).
  • append options are just added as they are (optional).
  • namespace can overwrite the DEFAULT_NAMESPACE variable (optional).
  • additional_names can supply additional image-names to upload to, i.e. to other registries (optional).

NOTE: For values in multiply, append, and namespace one may choose to use environment variables. Substition is handled by drone/envsubst

# docker-matrix.yml
multiply:
  VERSION:
    - 7.2
    - 7.3
  OS:
    - alpine
    - debian
    
append:
  - { NAME: test, LANG: ${LANG} }
  
namespace: images

additional_names:
  - docker.io/bitsbeats/image1
  - docker.io/bitsbeats/image2

The Dockerfile has to contain the argument names and default values. Example:

ARG \
  VERSION=7.3 \
  OS=debian \
  NAME=test
  
FROM php:$VERSION-fpm-$OS

RUN touch $NAME

Running without Drone

Example:

export PLUGIN_WORKDIR=/home/user42/docker-images
export PLUGIN_REGISTRY=registry.example.com
export PLUGIN_DEFAULT_NAMESPACE=images

drone-docker-matrix

About

A docker images builder with parameters for drone-ci

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published