94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: trytest
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: clone
|
|
pull: if-not-exists
|
|
image: alpine/git
|
|
volumes:
|
|
- name: sshkeys
|
|
path: /root/.ssh
|
|
commands:
|
|
- echo $DRONE_GIT_SSH_URL
|
|
- git clone $DRONE_GIT_SSH_URL .
|
|
- git checkout $DRONE_COMMIT
|
|
- name: restore-cache
|
|
pull: if-not-exists
|
|
image: drillster/drone-volume-cache
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
settings:
|
|
restore: true
|
|
mount:
|
|
- ./node_modules
|
|
- name: build-front
|
|
pull: if-not-exists
|
|
image: node
|
|
settings:
|
|
mirror: https://docker.mirrors.ustc.edu.cn
|
|
commands:
|
|
- yarn install
|
|
- yarn run build-test
|
|
- name: rebuild-cache
|
|
pull: if-not-exists
|
|
image: drillster/drone-volume-cache
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
settings:
|
|
rebuild: true
|
|
mount:
|
|
- ./node_modules
|
|
- name: build-image
|
|
pull: if-not-exists
|
|
image: plugins/docker
|
|
privileged: true
|
|
volumes:
|
|
- name: certs
|
|
path: /etc/docker/certs.d
|
|
settings:
|
|
mirror: https://docker.mirrors.ustc.edu.cn
|
|
dockerfile: docker/test/Dockerfile
|
|
repo: registry.happykit.net:5000/test/my-app
|
|
registry: registry.happykit.net:5000
|
|
tags: ${DRONE_BUILD_NUMBER}
|
|
username: admin
|
|
password: admin
|
|
|
|
- name: deploy-container
|
|
pull: if-not-exists
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host: 172.16.113.10
|
|
username: root
|
|
password: password
|
|
port: 22
|
|
script:
|
|
- docker login -u admin -p admin registry.happykit.net:5000
|
|
- docker pull registry.happykit.net:5000/test/my-app:${DRONE_BUILD_NUMBER}
|
|
- list=$(docker ps -a| grep test-my-app* | awk '{print $1}')
|
|
- test "$list" = "" && echo "none test-my-app containers running" || docker stop $list
|
|
- docker run -d -v /data/my-app:/logs --privileged=true -l "traefik.http.routers.web-service.rule=Host(\`web.happykit.net\`)" -l "traefik.http.services.web-service.loadbalancer.server.port=8080" --network=app_network --name=test-my-app-${DRONE_BUILD_NUMBER} registry.happykit.net:5000/test/my-app:${DRONE_BUILD_NUMBER}
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
- push
|
|
volumes:
|
|
- name: sshkeys
|
|
host:
|
|
path: /root/.ssh
|
|
- name: cache
|
|
host:
|
|
path: /tmp/cache
|
|
- name: certs
|
|
host:
|
|
path: /etc/docker/certs.d
|
|
|