ci
This commit is contained in:
parent
d8ecf4c5ab
commit
0b018e46e5
28
.gitlab-ci.yml
Normal file
28
.gitlab-ci.yml
Normal file
@ -0,0 +1,28 @@
|
||||
stages:
|
||||
- build-docker
|
||||
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
||||
docker-build:
|
||||
image: docker:latest
|
||||
stage: build-docker
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
|
||||
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}"
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
exists:
|
||||
- Dockerfile
|
Loading…
Reference in New Issue
Block a user