This folder provides makefile based API to help with devops tasks automation. Tasks are defined as make targets and could be run either on host or in docker containers. The folder includes the following files / dirs:
- Makefile defines pattern rule
%_in_dockerto run any target inside docker container and provides a set of other generally useful targets - docker folder holds docker related routine
- make
- docker
- docker-compose
This module provides a set of dockerfiles based on ubuntu xenial and centos7.
They have an hierarchy: rust images based on base ones.
Each version of these images is represented as separate dockerfile named Dockerfile.<VERSION>.
base docker images include generally useful packages and fpm along with rvm and ruby.
Notes:
- consider to use shell in login mode if you need
fpm(rvmandruby) available in the$PATH - consider to add all non-root users that will be using rvm to
rvmgroup
Environment variables:
FPM_VERSIONversion for thefpm- (
centos7only)RUBY_VERSIONversion of theruby
rust docker images are based on the base images and adds rust.
Supported arguments:
RUST_VERSION: version of therustto install. Default: depends on dockerfile version
Environment variables:
- RUST_VERSION version of the rust
%_in_dockerre-runs make for the matched target%inside$(DOCKER_NAME):$(DOCKER_TAG)docker image. Requires targetimage_%to be defined and expects that it builds necessary docker image. Environment variablesDOCKER_NAMEandDOCKER_TAGshould be defined as wellpackagecreates a package from the source code using fpm tool. Could be configured byFPM_*environment variablesimage_dockerbase_<type>:<osname>:<version>builds one of the base docker images along with its necessary images hierarchy wheretypeisbase|rust|python,osnameis one of possible oses for this image type,versionis one of the available versions for the pairtype-osname
Expects the following targets to be defined in child makefiles:
image_%: should build image with necessary environment to execute target%
OSNAME: switches OS context, possible values:xenial,centos7. Default:xenialEXPORT_ENV: list of variables that should be exported. Could be expanded by child dockerfiles. The list is also passed to in-docker make targets environment. Default:OSNAME PROJECT_NAMEPROJECT_DIR: absolute path of the top level project dir. Default: resolved asgit rev-parse --show-toplevelPRE_PACKAGE_GOALS: space separated list of targets that should be updated beforepackagetarget execution, i.e.$(PRE_PACKAGE_GOALS)is a prerequisite for the target. Default: not setDOCKER_NAME: name of the image to use in%_in_dockertarget's recipe. Default: not setDOCKER_TAG: tag of the image to use in%_in_dockertarget's recipe. Default: not setDOCKER_UID:uidof the user passed todocker runcommand. Default: resolved asid -u
Variables to config packaing using fpm tool:
- (please refer to fpm wiki for more information about the fpm command line options)
FPM_P_NAME(required fordirinput): value for fpm's--nameoption. Default: not setFPM_P_VERSION(required fordirinput): value for fpm's--versionoption. Default: not setFPM_P_INPUT_TYPE: value for fpm's--input-typeoption. Default:dirFPM_P_OUTPUT_TYPE: value for fpm's--output-typeoption. Default:debifOSNAME=xenial,rpmifOSNAME=centos7, otherwise - not setFPM_P_OUTPUT_DIR: value for fpm's--packageoption. Default: not setFPM_P_ARCH: value for fpm's--architectureoption. Default: not setFPM_P_MAINTAINER: value for fpm's--maintaineroption. Default: not setFPM_P_URL: value for fpm's--urloption. Default: not setFPM_P_LICENSE: value for fpm's--licenseoption. Default: not setFPM_P_DESCRIPTION: value for fpm's--descriptionoption. Default: not setFPM_ARGS: string with any fpm arguments to add to the end of the fpm command line. Default: not set- ... (please refer to fpm.mk for more details about fpm related environment variables)
The following variables could be used in call function and expects some arguments:
check_non_empty: check if value is non empty and raises error otherwise. Arguments:- value to check
- error message
check_defined: check if variable is defined (have non empty value) and raises error otherwise- variable name
- (optional) error message
docker_env_value: resolves the value of someENVinstruction in dockerfile. Arguments:ENV_V_NAME>is key inENVinstruction<PATH_TO_DOCKERFILE>path to dockerfile
docker_from_tag: resolves the tag of the base image defined inFROMinstruction in dockerfile. Arguments:<BASE_IMAGE_NAME>is name of the base image inFROMinstruction<PATH_TO_DOCKERFILE>
docker_from_version: resolves the version part of the base image's tag defined inFROMinstruction in dockerfile. It is expected that the tag has the following format:<VERSION>-.... Arguments:<BASE_IMAGE_NAME>is name of the base image inFROMinstruction<PATH_TO_DOCKERFILE>