Skip to content
Snippets Groups Projects
Commit dd449b2c authored by Corné Lukken's avatar Corné Lukken Committed by Paulus Kruger
Browse files

Build docker image in CI and push to registry

parent d705769f
No related branches found
No related tags found
1 merge request!16Build docker image in CI and push to registry
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}"
FROM ubuntu:20.04
COPY requirements.txt /requirements.txt
RUN apt-get update && apt-get install -y python3 python3-pip python3-yaml git && \
pip3 install -r requirements.txt
WORKDIR ./
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment