From 8ff16edec0083bf9f7ba8c674e840e2e0bb6981d Mon Sep 17 00:00:00 2001 From: thomas Date: Fri, 16 Dec 2022 15:01:54 +0800 Subject: [PATCH] =?UTF-8?q?build:=20:=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 41 +++++++++++++++++++++++++++++++++++++++++ Dockerfile | 10 ++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9ee69fe --- /dev/null +++ b/.drone.yml @@ -0,0 +1,41 @@ +--- +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 --add-host github.com:192.30.255.113 -t harbor.picaiba.com/kszny/cnbmai:1.0.0 ./ && docker push harbor.picaiba.com/kszny/cnbmai:1.0.0 + +- 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/cnbmai -n cnbmai + - sleep 3 + - kubectl scale --replicas=1 deployment/cnbmai -n cnbmai + depends_on: + - build + +volumes: +- name: dockersock + host: + path: /var/run/docker.sock +- name: dockerconfig + host: + path: /root/.docker + +trigger: + branch: + - projects/rcdhg + event: + - push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ebf16c7 --- /dev/null +++ b/Dockerfile @@ -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 + +FROM busybox +LABEL maintainer thomas.hairong@gmail.com +COPY --from=builder /app/dist /html -- 2.45.2