👷 添加自动构建发布配置
一些檢查失敗了
continuous-integration/drone/push Build is failing

This commit is contained in:
施海荣 2024-04-24 15:58:53 +08:00 提交者 Gitea
父節點 ec0c09a674
當前提交 9a53391999
共有 3 個檔案被更改,包括 63 行新增22 行删除

查看文件

@ -1,3 +1,3 @@
.dockerignore
dist
#dist
node_modules

59
.drone.yml Normal file
查看文件

@ -0,0 +1,59 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: node:16-alpine
pull: if_not_exists
environment:
NODE_ENV: ""
commands:
#- yarn install --frozen-lockfile
- yarn install
- env ${NODE_ENV} yarn build:prod
- name: publish
image: docker:dind
pull: if_not_exists
volumes:
- name: dockersock
path: /var/run/docker.sock
- name: dockerconfig
path: /root/.docker
commands:
- docker build -t hub.kszny.picaiba.com/kszny/xcac-ui ./
- docker push hub.kszny.picaiba.com/kszny/xcac-ui
depends_on:
- build
- name: deploy
image: appleboy/drone-ssh
pull: if-not-exists
settings:
host:
- 172.24.145.74
username: root
password: Root@123
port: 22
command_timeout: 2m
script:
- docker pull hub.kszny.picaiba.com/kszny/xcac-ui
- docker run --rm -v /data/www/xcac:/tmp hub.kszny.picaiba.com/kszny/xcac-ui sh -c "rm -rf /tmp/* && mv -f /html /tmp"
depends_on:
- publish
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: dockerconfig
host:
path: /root/.docker
trigger:
branch:
- projects/mesxc-test
event:
- push

查看文件

@ -1,21 +1,3 @@
FROM node:16-alpine as build-stage
WORKDIR /admim
COPY .npmrc package.json yarn.lock ./
RUN --mount=type=cache,id=yarn-store,target=/root/.yarn-store \
yarn install --frozen-lockfile
COPY . .
ARG NODE_ENV=""
RUN env ${NODE_ENV} yarn build:prod
## -- stage: dist => nginx --
FROM nginx:alpine
ENV TZ=Asia/Shanghai
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage /admim/dist /usr/share/nginx/html
EXPOSE 80
FROM busybox
LABEL maintainer thomas.hairong@gmail.com
COPY dist /html/