-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
56 lines (51 loc) · 1.46 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
stages:
- build
- push
build:master:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
only:
- master
script:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --no-push --destination $CI_REGISTRY_IMAGE:latest --tarPath image.tar
artifacts:
paths:
- image.tar
when: on_success
push:vcs:
stage: push
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane push image.tar $CI_REGISTRY_IMAGE:latest
needs:
- build:master
only:
- master
push:docker-hub:
stage: push
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
script:
- crane auth login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD registry.hub.docker.com
- crane push image.tar registry.hub.docker.com/timroemisch/mqtt-s7-connector:latest
needs:
- build:master
only:
- master
build:dev:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
script:
- mkdir -p /kaniko/.docker
- 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:dev-$CI_COMMIT_REF_SLUG
except:
- master