-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
34 lines (32 loc) · 1.07 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
stages:
- build
- deploy
build:
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:latest .
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
only:
- main
deploy:
stage: deploy
needs:
- build
image: maven:3.8.2-openjdk-17
before_script:
- curl -s ftp://ftp.jelastic.com/pub/cli/jelastic-cli-installer.sh | sh
- echo "n" | ~/jelastic/users/authentication/signin --login $EMAIL --password $PASSWORD --platformUrl $PLATFORM_URL
script:
- ~/jelastic/environment/control/getenvs
- ~/jelastic/environment/control/redeploycontainers --envName $ENV_NAME --nodeId $FRONTEND_NODE_ID --tag $CI_COMMIT_SHORT_SHA
only:
- main
# when: manual