build: :新增自动构建发布脚本

Esse commit está contido em:
施海荣 2022-09-21 17:10:00 +08:00
commit a95a7a20d3
3 arquivos alterados com 69 adições e 0 exclusões

7
.dockerignore Arquivo normal
Ver arquivo

@ -0,0 +1,7 @@
.vscode/
.idea/
node_modules/
dist/
**/*.log
LICENSE
README.md

52
.drone.yml Arquivo normal
Ver arquivo

@ -0,0 +1,52 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
- name: dockerconfig
path: /root/.docker
commands:
- docker build -t harbor.picaiba.com/kszny/mes-ui:1.0.0-india ./ && docker push harbor.picaiba.com/kszny/mes-ui:1.0.0-india
- name: deploy
image: harbor.picaiba.com/tools/kubectl:1.19.8
commands:
- echo "172.27.0.20 lb.kubesphere.local" >> /etc/hosts
#- echo "52.74.223.119 github.com" >> /etc/hosts
- sleep 1
- kubectl scale --replicas=0 deployment/mes-ui -n mes-india
- sleep 3
- kubectl scale --replicas=1 deployment/mes-ui -n mes-india
depends_on:
- build
- name: notification
image: lddsb/drone-dingtalk-message
settings:
token: 37a6483274f6de648a26d6710e4d8160eb7d471752abb2d70f8b7958af58fe11
type: markdown
secret: SEC83b10f5fefd6127e4073360d4447bb7276a90386aeee1275b2797dd377a903e7
tpl: http://res.picaiba.com/msg/msg.md
tips_title: 你有新消息
success_color: 008800
failure_color: FF0000
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: dockerconfig
host:
path: /root/.docker
trigger:
branch:
- develop
event:
- push

10
Dockerfile Arquivo normal
Ver arquivo

@ -0,0 +1,10 @@
FROM node:12 AS builder
WORKDIR /app
ADD package.json /app/
RUN npm config set registry https://registry.npmmirror.com && npm install
ADD . /app
RUN npm run build:prod
FROM busybox
LABEL maintainer thomas.hairong@gmail.com
COPY --from=builder /app/dist /html