From da279228a4799e2bd5f214ebd4931ace3c2a9543 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Sat, 10 Oct 2020 23:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0openresty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++++++++-- README.md | 0 admin@openresty.com-5ea678a6.rsa.pub | 9 +++++++++ build | 1 + conf/nginx.conf | 20 ++++++++++++++++++++ delete | 1 + exec | 1 + run | 1 + shell/initRisk | 6 +++--- 9 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 README.md create mode 100644 admin@openresty.com-5ea678a6.rsa.pub create mode 100644 build create mode 100644 conf/nginx.conf create mode 100644 delete create mode 100644 exec create mode 100644 run diff --git a/Dockerfile b/Dockerfile index 9d3202f..0a57522 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,16 @@ RUN mkdir /app COPY shell/* /app/ #为命令建立软链接 RUN ln -s /app/* /usr/local/bin/ && chmod +x /app/* -#使用阿里云镜像源安装git和openssh -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk update && apk add git openssh curl +#启用 openresty 仓库 +COPY admin@openresty.com-5ea678a6.rsa.pub /etc/apk/keys/admin@openresty.com-5ea678a6.rsa.pub +RUN MAJOR_VER=`echo $VERSION_ID | sed 's/\.[0-9]\+$//'` && echo "http://openresty.org/package/alpine/v$MAJOR_VER/main" \ +| sudo tee -a /etc/apk/repositories +#使用阿里云镜像源安装git openssh curl openresty +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk update && apk add git openssh curl openresty +WORKDIR /usr/local/openresty/nginx +#备份openresty默认配置,拷贝自定义配置 +RUN move conf/nginx.conf conf/nginx.conf.bak +COPY conf/nginx.conf conf/nginx.conf #拷贝应用代码 WORKDIR /app #git web钩子服务端 @@ -18,6 +26,7 @@ RUN git clone git@gogs.kirito.cool:panqihua/RiskCloudRun.git WORKDIR /app/RiskCloudRun #安装依赖 RUN yarn + WORKDIR /app #运行web服务端 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/admin@openresty.com-5ea678a6.rsa.pub b/admin@openresty.com-5ea678a6.rsa.pub new file mode 100644 index 0000000..9fe7d70 --- /dev/null +++ b/admin@openresty.com-5ea678a6.rsa.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHjbPqu0JdFpIJ8cUqP3 +aC01s/lqr42y3IeOjGckIRV3CewpI+FxONZ4e6uQmOVNYdv2r7Va2qxqRreQVtx8 +rpwGgM/CGD8j5MZNTsA8u9hby4njy/2hCskNpMNmciPj5iOwokFoiegJOKYQktbg +Tcba+7QK1ThqaIxzv74p+xuEvVtW9FiAiyDPG4xGBxIDkI02qf3Mtd4Wgp9d5K8t +wD0hGVeLSbvbyHrrXLQXpukgymdQmqhNvWMLd7sApCFzl8JOq5NmsolARqBq69rK +LeW/mHzNSn/Sq8OJmEFKkZ+FGxp1tMpTgOGi+EAtspJ+u7HWi3Xb49Jtfhuw1Uzq +lQIDAQAB +-----END PUBLIC KEY----- diff --git a/build b/build new file mode 100644 index 0000000..0ae11cf --- /dev/null +++ b/build @@ -0,0 +1 @@ +git pull && docker build . -t test:1.0 --no-cache diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..f374719 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,20 @@ +worker_processes 1; +error_log logs/error.log; +events { + worker_connections 1024; +} +http { + server { + listen 8080; + location / { + access_by_lua ' + + local t = io.popen("checkPort") + local a = t:read("*all") + + ngx.say("

当前进程"..a.."

") + +'; + } + } +} \ No newline at end of file diff --git a/delete b/delete new file mode 100644 index 0000000..f7bd5a8 --- /dev/null +++ b/delete @@ -0,0 +1 @@ +docker stop test && docker rm test && docker rmi test:1.0 diff --git a/exec b/exec new file mode 100644 index 0000000..f1d1b67 --- /dev/null +++ b/exec @@ -0,0 +1 @@ +docker exec -it test /bin/sh diff --git a/run b/run new file mode 100644 index 0000000..90ec1c9 --- /dev/null +++ b/run @@ -0,0 +1 @@ +docker run --name test -p 3000:3000 -p 2233:2233 -p 5000:5000 test:1.0 & diff --git a/shell/initRisk b/shell/initRisk index 5cf716a..2113dca 100644 --- a/shell/initRisk +++ b/shell/initRisk @@ -3,9 +3,9 @@ #运行web服务端 updateRisk RiskCloudMock -#ENTRYPOINT ["updateRisk","RiskCloudMock"] #运行web客户端 updateRisk RiskCloudFontend -#ENTRYPOINT ["updateRisk","RiskCloudFontend"] +#运行openresty +/usr/local/openresty/nginx/sbin/nginx #运行自动部署服务端 -node /app/RiskCloudRun/bin/www +node /app/RiskCloudRun/bin/www \ No newline at end of file