我有两个项目要停靠,我怀疑nginx端口转发之间有问题,我在这个问题上是新手,Dockefile如下:
//Dockerfile NodeJS(后台)
FROM alpine as node-build
RUN apk add --update nodejs npm
WORKDIR /app
COPY . .
RUN npm install
CMD [ "node", "server.js" ]
//DockerfileAngular (前端)
FROM node:16-alpine as frontend
WORKDIR /app
COPY . .
RUN npm install
RUN npm run frontend
FROM nginx:alpine
COPY --from=frontend /app/dist/frontend /usr/share/nginx/html
//Docker Compose
version: '2.0'
services:
backend:
build:
context: './backend'
ports:
- "3000:3000"
frontend:
build:
context: './frontend'
ports:
- "4200:80"
//前端代理(/Fronend/proxy.config.json)
{
"/enviroment/*":{
"target": "http://localhost:3000",
"secure": false,
"loglevel": "debug"
}
}
我怎么才能让他们之间进行交流呢?
暂无答案!
目前还没有任何答案,快来回答吧!