将前后端分离的代理独立出来,并解决了一系列nginx代理问题
This commit is contained in:
parent
1abc63a603
commit
1021a2d6be
@ -25,11 +25,9 @@ services:
|
|||||||
- app-network
|
- app-network
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:stable-alpine
|
build: ./nginx
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
|
@ -24,7 +24,7 @@ FROM nginx:stable-alpine as production-stage
|
|||||||
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# 复制Nginx配置文件
|
# 复制Nginx配置文件
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# 暴露80端口
|
# 暴露80端口
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
11
nginx/Dockerfile
Normal file
11
nginx/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 使用Nginx作为基础镜像
|
||||||
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
|
# 复制Nginx配置文件
|
||||||
|
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# 暴露80端口
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# 启动Nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
Loading…
x
Reference in New Issue
Block a user