-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
123 lines (116 loc) · 3.48 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
stages:
- build
- package
- deploy
build-main:
image: azul/zulu-openjdk:17-latest
stage: build
script:
- cat
- cd ./BE/relpl
- chmod +x ./gradlew
- ./gradlew clean
- ./gradlew build
artifacts:
paths:
- ./BE/relpl/build/libs/*.jar
expire_in: 10 min
only:
- be/develop
build-sub:
image: azul/zulu-openjdk:17-latest
stage: build
script:
- cat
- cd ./BE/initDB_relpl
- chmod +x ./gradlew
- ./gradlew clean
- ./gradlew build
artifacts:
paths:
- ./BE/initDB_relpl/build/libs/*.jar
expire_in: 10 min
only:
- be/feat/tmap
package-main:
image: docker:latest
stage: package
variables:
IMAGE_NAME: vadeski/ksh-backend
services:
- name: docker:dind
command: ["--privileged=true", "--tls=false"]
before_script:
- echo "$DOCKER_HUB_PW" | docker login --username $DOCKER_HUB_USER --password-stdin
- echo "로그인 성공"
script:
- cd ./BE/relpl
- docker buildx create --use --name mybuilder
- docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$CI_PIPELINE_IID --push .
- docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:latest --push .
- echo "build complete"
after_script:
- docker logout
only:
- be/develop
package-sub:
image: docker:latest
stage: package
variables:
IMAGE_NAME: vadeski/backend_sub
services:
- name: docker:dind
command: ["--privileged=true", "--tls=false"]
before_script:
- echo "$DOCKER_HUB_PW" | docker login --username $DOCKER_HUB_USER --password-stdin
- echo "로그인 성공"
script:
- cd ./BE/initDB_relpl
- docker buildx create --use --name mybuilder
- docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$CI_PIPELINE_IID --push .
- docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:latest --push .
- echo "build complete"
after_script:
- docker logout
only:
- be/feat/tmap
deploy-was:
stage: deploy
variables:
IMAGE_NAME: vadeski/ksh-backend
tags:
- ksh-runner
before_script:
# - docker login --username $DOCKER_HUB_USER --password-stdin < $DOCKER_HUB_PW
- echo "$DOCKER_HUB_PW" | docker login --username $DOCKER_HUB_USER --password-stdin
#- echo "$DOCKER_HUB_PW" | docker login --username --password-stdin
script:
- docker stop ksh-backend || true
- docker rm ksh-backend || true
- docker rmi $IMAGE_NAME || true
- docker pull $IMAGE_NAME:latest
- docker run -d --restart always -e TZ=Asia/Seoul -e REDIS_PASSWORD=$REDIS_PASSWORD -e JASYPT_PASSWORD=$JASYPT_PASSWORD -e MONGODB_PORT=$MONGODB_PORT -e REDIS_PORT=$REDIS_PORT -p $SPRING_PORT:$SERVER_SPRING_PORT/tcp --name ksh-backend $IMAGE_NAME:latest
after_script:
- docker logout
when: on_success
only:
- be/develop
deploy-sub:
stage: deploy
variables:
IMAGE_NAME: vadeski/backend_sub
tags:
- ksh-runner
before_script:
- echo "$DOCKER_HUB_PW" | docker login --username $DOCKER_HUB_USER --password-stdin
script:
- docker stop ksh-backend-sub || true
- docker rm ksh-backend-sub || true
- docker rmi $IMAGE_NAME || true
- docker pull $IMAGE_NAME:latest
- docker run -d --restart always -e TZ=Asia/Seoul -e JASYPT_PASSWORD=$JASYPT_PASSWORD -e MONGODB_PORT=$MONGODB_PORT -e REDIS_PORT=$REDIS_PORT -p $SPRING_SUB_PORT:$SPRING_SUB_PORT/tcp --name ksh-backend-sub $IMAGE_NAME:latest
after_script:
- docker logout
when: on_success
only:
- be/feat/tmap