CI configuration.

This commit is contained in:
Stanislav Nikitin 2019-09-25 18:47:51 +05:00
parent 7f2174a33e
commit 333fc1d12a
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE
2 changed files with 38 additions and 0 deletions

31
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,31 @@
image: docker:dind
variables:
HOST: 0.0.0.0
PORT: 2375
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CONTAINER_NAME: registry.gitlab.com/pztrn/fastpastebin
GIT_STRATEGY: clone
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
stages:
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
build:
stage: build
tags:
- docker
script:
- source docker/set_docker_tag.sh
- docker build -t $CONTAINER_NAME:$DOCKER_TAG .
- docker push $CONTAINER_NAME:$DOCKER_TAG
only:
- tags
- master

7
docker/set_docker_tag.sh Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
if [[ $CI_BUILD_REF_NAME == "master" ]]; then
export DOCKER_TAG=latest;
else
export DOCKER_TAG="${CI_BUILD_REF_NAME}";
fi