-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
42 lines (38 loc) · 1.23 KB
/
.gitlab-ci.yml
File metadata and controls
42 lines (38 loc) · 1.23 KB
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
stages:
- deploy
- manual_deploy
image: docker:20.10.21
services:
- docker:20.10.21-dind
deploy-on-dev:
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
- eval $(ssh-agent -s) && echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- export BASE_URL=$BASE_URL_DEV && export IP=$IP_DEV
- ssh-keyscan $IP >> ~/.ssh/known_hosts
- export DOCKER_HOST=ssh://urbng@$IP
script:
- docker compose --profile dev up -d --build --force-recreate --remove-orphans
tags:
- ilab
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
deploy-on-prod:
stage: manual_deploy
needs: [deploy-on-dev]
when: manual
before_script:
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
- eval $(ssh-agent -s) && echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- export BASE_URL=$BASE_URL_PROD && export IP=$IP_PROD
- ssh-keyscan $IP >> ~/.ssh/known_hosts
- export DOCKER_HOST=ssh://urbng@$IP
script:
- docker compose --profile prod up -d --build --force-recreate --remove-orphans
tags:
- ilab
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH