-
Notifications
You must be signed in to change notification settings - Fork 18
/
.gitlab-ci.yml
32 lines (24 loc) · 1000 Bytes
/
.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
# Use Kaniko to build on containers without root, ie on Kubernetes
image:
name: registry.heimsbakk.no:5487/docker/kaniko/executor:debug
entrypoint: [""]
variables:
VERSION: latest
before_script:
- sed -i "s/VERSION/${VERSION}/g" Dockerfile
# Check if we build successfully on all branches.
test:
stage: test
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --no-push
except:
- master
# Build container and push to registry for master branch.
build:
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$VERSION
only:
- master