ci
continuous-integration/drone/push Build was killed Details

This commit is contained in:
周炽键 2021-08-16 23:47:37 +08:00
parent f7771815d8
commit 3256f2b3e4
6 changed files with 131 additions and 54 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
.tags
.tags

68
.drone copy.yml Normal file
View File

@ -0,0 +1,68 @@
kind: pipeline
type: exec
name: dev-admin-backend
node:
mode: dev2
trigger:
branch: ci
steps:
- name: inject-file
environment:
ORMCONFIG:
from_secret: ORMCONFIG
ENV:
from_secret: ENV
commands:
- echo -n "$ORMCONFIG" > ormconfig.json
- echo -n "$ENV" > config/.env
- name: build
commands:
- rm package-lock.json || true
- yarn
- yarn build
- export HOME=/root
- pm2 del dev-admin-backend || true
- mkdir /opt/nodewww/dev-admin-backend || rm -rf /opt/nodewww/dev-admin-backend/*
- mv ./* /opt/nodewww/dev-admin-backend
- name: deploy
commands:
- cd /opt/nodewww/express-admin-template
- export OLDHOME=$HOME
- export HOME=/root
- pm2 start -i 0 --name dev-admin-backend ./bin/www
- pm2 startup
- pm2 save
---
kind: pipeline
type: docker
name: dev-admin-backend-builder
node:
mode: dev
trigger:
branch: ci
steps:
- name: build-docker-image
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: docker_reg_username
password:
from_secret: docker_reg_password
repo: docker.zcj.plus/zhouchijian/express-admin-template
tags: dev
registry: https://docker.zcj.plus
depends_on:
- dev-admin-backend

View File

@ -1,68 +1,51 @@
kind: pipeline kind: pipeline
type: exec
name: dev-admin-backend
node:
mode: dev2
trigger:
branch: ci
steps:
- name: inject-file
environment:
ORMCONFIG:
from_secret: ORMCONFIG
ENV:
from_secret: ENV
commands:
- echo -n "$ORMCONFIG" > ormconfig.json
- echo -n "$ENV" > config/.env
- name: build
commands:
- rm package-lock.json || true
- yarn
- yarn build
- export HOME=/root
- pm2 del dev-admin-backend || true
- mkdir /opt/nodewww/dev-admin-backend || rm -rf /opt/nodewww/dev-admin-backend/*
- mv ./* /opt/nodewww/dev-admin-backend
- name: deploy
commands:
- cd /opt/nodewww/express-admin-template
- export OLDHOME=$HOME
- export HOME=/root
- pm2 start -i 0 --name dev-admin-backend ./bin/www
- pm2 startup
- pm2 save
---
kind: pipeline
type: docker type: docker
name: dev-admin-backend-builder name: release
node: node:
mode: dev mode: dev
trigger: trigger:
branch: ci event:
- tag
steps: steps:
- name: build-docker-image
- name: build-image
image: plugins/docker image: plugins/docker
pull: if-not-exists pull: if-not-exists
settings: settings:
username: username:
from_secret: docker_reg_username from_secret: repo_username
password: password:
from_secret: docker_reg_password from_secret: repo_password
repo: docker.zcj.plus/zhouchijian/express-admin-template repo: docker.zcj.plus/zhouchijian/demo/express-template
tags: dev
registry: https://docker.zcj.plus registry: https://docker.zcj.plus
depends_on: ---
- dev-admin-backend kind: pipeline
type: docker
name: dev
node:
mode: dev
trigger:
event:
- push
branch:
- ci
steps:
- name: build-image
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: repo_username
password:
from_secret: repo_password
repo: docker.zcj.plus/zhouchijian/demo/express-template
registry: https://docker.zcj.plus

2
.gitignore vendored
View File

@ -63,3 +63,5 @@ typings/
dist dist
ormconfig.json ormconfig.json
.tags

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:lts-stretch
WORKDIR /src
COPY . .
RUN cp ormconfig.example.json ormconfig.json && \
cp example.env .env && \
yarn && \
npm install pm2 -g
EXPOSE 80-60000
VOLUME ['/src']
CMD ["./pm2.sh"]

5
pm2.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
pm2 start --name express-template ./www -i 0
pm2 log