Docker Build
Objective
Build a Docker image and push it to the GitLab registry.
How to use it
Include the component/template
Add the following to your .gitlab-ci.yml
file.
As a remote Template (recommended):
include:
- remote: 'https://gitlab.com/swepy/cicd-templates/docker-build/-/raw/0.2.1/templates/docker-build.yml'
As a local Template (if the template is local to the instance):
include:
- project: 'swepy/cicd-templates/docker-build'
ref: '0.2.1'
file: 'templates/docker-build.yml'
As a Component (beta and if the component is local to the instance):
include:
- component: $CI_SERVER_FQDN/swepy/cicd-templates/docker-build/docker-build@0.2.1
Customize job
You can customize the job by overriding specific keys. For example:
docker-build:
stage: build_img
Variables
You can customize the job by overriding the following variables:
Name | Description | Default |
---|---|---|
DOCKER_HOST |
The path to the Docker Host | tcp://docker:2375/ |
DOCKER_DRIVER |
The name of the Docker driver. | overlay2 |
TARGET_IMAGE |
The nmae and tag of the target image. | $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA |
PROJECT_PATH |
The tag to apply to the image. | . |
KANIKO_OPTIONS |
The Kaniko options. | "" |