基于nginx docker 构建镜像

This commit is contained in:
周炽键 2021-06-06 10:37:12 +08:00
parent 74afe6fdd9
commit 547d96ea2c
4 changed files with 32 additions and 18 deletions

View File

@ -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"]
CMD ["nginx","-g","daemon off;"]

15
Node.Dockerfile Normal file
View File

@ -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"]

View File

@ -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

View File

@ -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;
}
}