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.0/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.0'
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.0
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_TLS_CERTDIR |
The path to the Docker TLS dir | "" |
IMAGE_NAME |
The name of the image. | $CI_PROJECT_NAME |
PROJECT_PATH |
The path to the project. | . |
TAG |
The tag to apply to the image. | $CI_COMMIT_SHA |
TARGET_IMAGE |
The target image name. | $CI_REGISTRY_IMAGE:$TAG |