From 66b6afce40786edc16962064e141e3d2f5b6638e Mon Sep 17 00:00:00 2001 From: thomas Date: Sat, 15 Apr 2023 22:31:14 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20:new:=20=E6=96=B0=E5=A2=9E=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 6 ++++++ .drone.yml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 20 ++++++++++++++---- 3 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 .drone.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8cea9cb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.vscode/ +.idea/ +node_modules/ +**/*.log +LICENSE +README.md diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..1843377 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,57 @@ +--- +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/report-ui:1.0.0 ./ && docker push harbor.picaiba.com/kszny/report-ui:1.0.0 + +- name: deploy + image: harbor.picaiba.com/tools/kubectl:1.19.8 + commands: + - echo "139.155.60.236 lb.kubesphere.local" >> /etc/hosts + # - 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/report-ui -n wms-basic + - sleep 3 + - kubectl scale --replicas=1 deployment/report-ui -n wms-basic + 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 + depends_on: + - build + - deploy + +volumes: +- name: dockersock + host: + path: /var/run/docker.sock +- name: dockerconfig + host: + path: /root/.docker + +trigger: + branch: + - master + event: + - push + diff --git a/Dockerfile b/Dockerfile index b3f73aa..ef28530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,16 @@ -# Dockerfile -FROM nginx:alpine -COPY dist/ /usr/share/nginx/html/ -EXPOSE 80 \ No newline at end of file +# FROM node:12 AS builder +# WORKDIR /app +# ADD package.json /app/ +# RUN npm install \ +# --registry=https://registry.npm.taobao.org \ +# --disturl=https://npm.taobao.org/dist +# ADD . /app +# RUN npm run build:prod + +# FROM busybox +# LABEL maintainer thomas.hairong@gmail.com +# COPY --from=builder /app/dist /html + +FROM busybox +LABEL maintainer thomas.hairong@gmail.com +COPY dist/ /html