-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
52 lines (44 loc) · 984 Bytes
/
.gitlab-ci.yml
File metadata and controls
52 lines (44 loc) · 984 Bytes
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
stages:
- build
- test
- deploy
variables:
MAVEN_CLI_OPTS: "-s .maven/settings.xml --batch-mode --errors --fail-at-end --show-version"
DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCKER_CACHE_IMAGE: $CI_REGISTRY_IMAGE:cache
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository/
- target/
before_script:
- export DOCKER_BUILDKIT=1
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build:
stage: build
script:
- ./mvnw clean package $MAVEN_CLI_OPTS
artifacts:
paths:
- target/*.jar
test:
stage: test
services:
- docker:dind
script:
- ./mvnw test $MAVEN_CLI_OPTS
docker-build:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker build --target production -t $DOCKER_IMAGE_TAG .
- docker push $DOCKER_IMAGE_TAG
deploy:
stage: deploy
only:
- main
script:
- docker-compose -f docker-compose.yml up -d
- docker ps