-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
45 lines (40 loc) · 998 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
image: docker:19.03
services:
- docker:dind
stages:
- build
- package
- push
variables:
MAVEN_CLI_OPTS: "--batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
LATEST_TAG: $CI_REGISTRY_IMAGE:latest
DOCKER_TLS_CERTDIR: "/certs"
cache:
paths:
- .m2/repository/
- target/
build_jar:
image: maven:3.6.3-jdk-8
stage: build
script:
- mvn $MAVEN_CLI_OPTS package -DskipTests
artifacts:
paths:
- target/NeologRecommender-jar-with-dependencies.jar
docker_push:
variables:
GIT_STRATEGY: none # We are just playing with Docker here. We do not need GitLab to clone the source code.
image: docker:19.03
stage: push
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
- docker tag $IMAGE_TAG $LATEST_TAG
- docker push $LATEST_TAG
only:
- master