diff --git a/Dockerfile b/Dockerfile index f2d2bffd..13796b50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,21 @@ -FROM node:lts +FROM node:lts as dist WORKDIR /src COPY . . -RUN yarn global add http-server && \ - npm install pm2 -g && \ - yarn && \ +RUN yarn && \ yarn build:prod + +FROM nginx:1.19.2 + +WORKDIR /app + +COPY --from=dist /src/dist . + +COPY nginx.conf /etc/nginx/nginx.conf + EXPOSE 80 -# CMD ["http-server","/src/dist","-p","80"] - -CMD ["bash","http.sh"] \ No newline at end of file +CMD ["nginx","-g","daemon off;"] \ No newline at end of file diff --git a/Node.Dockerfile b/Node.Dockerfile new file mode 100644 index 00000000..dbd25ebd --- /dev/null +++ b/Node.Dockerfile @@ -0,0 +1,15 @@ +FROM node:lts + +WORKDIR /src + +COPY . . + +RUN yarn && \ + yarn build:prod && \ + yarn global add pm2 http-server + +EXPOSE 80 + +# CMD ["http-server","/src/dist","-p","80"] + +CMD ["bash","http.sh"] \ No newline at end of file diff --git a/frpc.ini b/frpc.ini index f00da160..11d0248f 100644 --- a/frpc.ini +++ b/frpc.ini @@ -10,8 +10,8 @@ admin_pwd = 39zcj [http-demo-admin-ci] type = http -custom_domains = demo-admin.ryio.cn -local_ip = nginx +custom_domains = demo.ryio.cn +local_ip = web local_port = 80 remote_port = 80 use_encryption = true diff --git a/nginx.conf b/nginx.conf index 381021a2..a65cffce 100644 --- a/nginx.conf +++ b/nginx.conf @@ -58,21 +58,15 @@ http { # Virtual Host Configs ## - include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { listen 80; - server_name demo-admin.ryio.cn; location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_set_header REMOTE-HOST $remote_addr; - - proxy_pass http://wev/; + root /app; + index index.html; + try_files $uri $uri/ /index.html; } }