diff --git a/.drone.yml b/.drone.yml index 0e9d1f4..6d16b4d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,17 +15,18 @@ steps: # - npm config set registry https://registry.npm.taobao.org # - SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass - npm install - - npm run build:dev + - npm run build:prod - cp -r ./dist /home/app/web/dist - cp Dockerfile /home/app/web/Dockerfile - cp docker.sh /home/app/web/docker.sh + - cp nginx.conf /home/app/web/nginx.conf - name: build-start image: appleboy/drone-ssh # SSH工具镜像 settings: - host: 192.168.0.110 # 远程连接地址 + host: 192.168.1.103 # 远程连接地址 username: root # 远程连接账号 password: dy20090625 # 远程连接密码 - # from_secret: dy20090625 # 从Secret中读取SSH密码 + # from_secret: dy20090625 # 从Secret中读取SSH密码 port: 22 # 远程连接端口 command_timeout: 5m # 远程执行命令超时时间 script: diff --git a/Dockerfile b/Dockerfile index d3cc19c..2e0f4b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,6 @@ FROM nginx:latest MAINTAINER chinasoft # 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面 COPY dist/ /usr/share/nginx/html/ +COPY ./nginx.conf /etc/nginx/conf.d/default.conf EXPOSE ${innerPort} ENTRYPOINT nginx -g "daemon off;" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2aba5f5 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +server { + listen ${webPort}; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + location /admin-api/ { + # 去掉/prod-api前缀 + rewrite ^/admin-api/(.*)$ /$1 break; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass ${serverIp}; + break; + } +}