-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
58 lines (53 loc) · 1.4 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
variables:
NODE_VERSION: 20
DOMAIN_NAME: fundermaps.lemone.design
SERVER_NAME: nebula.lemone.network
DEPLOY_USER: deploy
before_script:
- echo "Setup SSH keypair"
- "which ssh-agent || ( apk add --update openssh-client )"
- eval $(ssh-agent -s)
- echo "$NGINX_PROXY_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $SERVER_NAME >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
stages:
- build
- deploy
yarn build:
image: node:$NODE_VERSION
stage: build
script:
- yarn
- yarn build
artifacts:
name: "build-$CI_PIPELINE_ID"
paths:
- dist
pages:
stage: deploy
script:
- mkdir public
- mv dist/* public/
artifacts:
name: "$CI_PIPELINE_ID"
paths:
- public
expire_in: 5 days
when: always
only:
- develop
deploy:
stage: deploy
script:
- apk add rsync
- ssh $DEPLOY_USER@$SERVER_NAME "mkdir -p /srv/www/vhosts/$DOMAIN_NAME/public"
- rsync -rtvz -e "ssh -o StrictHostKeyChecking=no" --chmod=D2755,F644 dist/ $DEPLOY_USER@$SERVER_NAME:/srv/www/vhosts/$DOMAIN_NAME/public
- rsync -rtvz -e "ssh -o StrictHostKeyChecking=no" --chmod=D2755,F644 docker-compose.yml $DEPLOY_USER@$SERVER_NAME:/srv/www/vhosts/$DOMAIN_NAME/
- ssh $DEPLOY_USER@$SERVER_NAME "cd /srv/www/vhosts/$DOMAIN_NAME && docker-compose up -d --build"
artifacts:
paths:
- public
only:
- main