-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
41 lines (37 loc) · 1.15 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
default:
image: docker:19.03.8
before_script:
- apk add git
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
variables:
CI_REGISTRY: docker.io
CI_REGISTRY_IMAGE: jibrelnetwork/$CI_PROJECT_NAME
docker-build-master:
stage: build
services:
- docker:19.03.8-dind
script:
- git submodule sync --recursive
- git submodule update --init --recursive
- docker build --pull -t "$CI_REGISTRY_IMAGE:latest" .
- docker push "$CI_REGISTRY_IMAGE:latest"
only:
- master
docker-build:
stage: build
services:
- docker:19.03.8-dind
script:
- git submodule sync --recursive
- git submodule update --init --recursive
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
only:
- develop
- /^feature/.*$/