demo ci
continuous-integration/drone/push Build is failing Details

This commit is contained in:
周炽键 2021-06-05 22:26:15 +08:00
parent 8572222960
commit ad8f790e18
6 changed files with 50 additions and 102 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -7,99 +7,24 @@ trigger:
steps: steps:
- name: net - name: build-docker-image
image: praqma/network-multitool image: plugins/docker
commands:
- ifconfig
- ping -c 2 bucket || true
- name: upload
image: plugins/s3
settings: settings:
endpoint: http://bucket:9000 username:
access_key: from_secret: docker_reg_username
from_secret: bucket_access_key password:
secret_key: from_secret: docker_reg_password
from_secret: bucket_secret_key repo: docker.zcj.plus/drone-ci/fe
bucket: dronetest tags: latest
path_style: true registry: https://docker.zcj.plus
source: src/*
target: /
# - name: prepare-deploy-file
# image: apline
# - name: rebuild
# image: drillster/drone-volume-cache
# volumes:
# - name: modules
# path: /cache
# settings:
# rebuild: true
# mount:
# - .env
# - name: restore-modules
# image: drillster/drone-volume-cache
# volumes:
# - name: modules
# path: /cache
# settings:
# restore: true
# mount:
# - ./node_modules
# - ./yarn.lock
# - name: build
# image: node:12.16.1
# commands: # commands:
# - yarn # - echo -e ""
# - yarn build:prod
# - name: rebuild-modules - name: deploy
# image: drillster/drone-volume-cache image: docker/compose
# volumes: commands:
# - name: modules - docker-compose up -d
# path: /cache - docker-compose logs -f
# settings:
# rebuild: true
# mount:
# - ./node_modules
# - ./yarn.lock
# - name: scp
# image: appleboy/drone-scp
# settings:
# host: 124.156.152.247
# username:
# from_secret: ssh_username
# password:
# from_secret: ssh_pwd
# port: 8011
# target:
# - /mnt/d/deploy/fe/cidemoadmin
# source:
# - dist
# - docker-compose.yml
# - nginx.conf
# - frpc.ini
# - name: deploy
# image: appleboy/drone-ssh
# settings:
# host: 124.156.152.247
# username:
# from_secret: ssh_username
# password:
# from_secret: ssh_pwd
# port: 8011
# script:
# - cd /mnt/d/deploy/fe/cidemoadmin
# - docker-compose down
# - docker-compose up -d
# - docker-compose logs
volumes:
- name: modules
host:
path: /mnt/d/ci_volumes

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:lts
WORKDIR /src
COPY . .
RUN yarn global add http-server && \
npm install pm2 -g && \
yarn && \
yarn build:prod
EXPOSE 80
# CMD ["http-server","/src/dist","-p","80"]
CMD ["bash","http.sh"]

View File

@ -2,11 +2,8 @@ version: '3'
services: services:
nginx: web:
image: nginx:1.19.2 image: docker.zcj.plus/drone-ci/fe
volumes:
- ./dist:/var/www
- ./nginx.conf:/etc/nginx/nginx.conf
networks: networks:
- feadmindroneci - feadmindroneci
@ -17,7 +14,7 @@ services:
volumes: volumes:
- ./frpc.ini:/etc/frp/frpc.ini - ./frpc.ini:/etc/frp/frpc.ini
depends_on: depends_on:
- nginx - web
restart: always restart: always
networks: networks:

5
http.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pm2 start http-server -i 4 -- /src/dist -p 80
pm2 monit

View File

@ -63,12 +63,16 @@ http {
server { server {
listen 80; listen 80;
server_name demo-admin.ryio.cn; server_name demo-admin.ryio.cn;
location / { location / {
root /var/www; proxy_set_header X-Real-IP $remote_addr;
index index.html; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
try_files $uri $uri/ /index.html; proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_pass http://wev/;
} }
} }