Skip to content
Snippets Groups Projects
Commit 72699a3b authored by Corné Lukken's avatar Corné Lukken
Browse files

Add gitlab-ci.yml to automatically build docker images

parent ae80ef94
Branches
Tags
No related merge requests found
Pipeline #20873 passed
stages:
- image
docker-build:
stage: image
image: docker:latest
tags:
- privileged
only:
refs:
- master
services:
- docker:dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment