-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.gitlab-ci.yml
40 lines (32 loc) · 911 Bytes
/
.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
variables:
GIT_DEPTH: 1
cache:
key: "vue-blog"
paths:
- node_modules
stages:
- build
- make
upload_to_oss:
image: node:alpine
stage: build
script:
- npm install --registry https://registry.npm.taobao.org
- npm run build
artifacts:
when: on_success
paths:
- ./dist
make_image:
cache: {}
stage: make
before_script:
- docker login "$DOCKER_REPOSITORY_ALI" -u="$DOCKER_USERNAME_ALI" -p="$DOCKER_PASSWORD_ALI"
script:
- sed -i "s/blog:\w\+-FE/blog:$CI_COMMIT_SHORT_SHA-FE/g" docker-compose.yml
- docker build
-t "$DOCKER_REPOSITORY_ALI"/calabash/blog:"$CI_COMMIT_SHORT_SHA"-FE
-f ./Dockerfile .
- docker push $DOCKER_REPOSITORY_ALI/calabash/blog:$CI_COMMIT_SHORT_SHA-FE
- scp -P $SSH_PORT ./docker-compose.yml deploy-server:~/deploy/blog/fe
- ssh deploy-server -p $SSH_PORT "cd ~/deploy/blog/fe && docker-compose up -d"