Docker Build
Objective
Build a Docker image and push it to the GitLab registry.
How to use it
Include the component
Add the following to your .gitlab-ci.yml
file.
include:
- component: $CI_SERVER_FQDN/swepy/cicd-templates/docker-build/docker-build@0.3.0
See more for GitLab here: docs/gitlab.md.
Inputs
You can customize the job by overriding specific inputs.
Name | Description | Default |
---|---|---|
stage |
Stage of the job. | build |
image-id |
Image name and tag of the built image. | $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA |
context-path |
Path to the build context, usually the project. | . |
dockerfile-name |
Name of the dockerfile. | Dockerfile |
options |
Additional options to pass to Podman for image building. | "" |
version |
Version tag of the Podman image. | stable |
For example:
include:
- component: $CI_SERVER_FQDN/swepy/cicd-templates/docker-build/docker-build@0.3.0
inputs:
stage: docker_build
context_path: ./project
Customize with variables
You can customize the job by overriding the following variables:
Name | Description | Default |
---|---|---|
IMAGE_ID |
Image name and tag of the built image. | $[[ inputs.image-id ]] |
CONTEXT_PATH |
Path to the build context, usually the project. | $[[ inputs.context-path ]] |
DOCKERFILE_NAME |
Name of the dockerfile. | $[[ inputs.dockerfile-name ]] |
OPTIONS |
Additional options to pass to Podman for image building. | $[[ inputs.options ]] |
VERSION |
Version tag of the Podman image. | $[[ inputs.version ]] |