migrate from express to nginx proxy pt.1
This commit is contained in:
parent
6bc5a52a37
commit
707f9aaa9b
@ -4,3 +4,4 @@ yarn.lock
|
||||
yarn-error.log
|
||||
*.log
|
||||
.git
|
||||
build
|
||||
21
Dockerfile
21
Dockerfile
@ -1,17 +1,22 @@
|
||||
FROM node:14-alpine as build
|
||||
FROM node:14-alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json /app/package.json
|
||||
COPY package.json /app/
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm install -g cross-env dotenv-cli
|
||||
RUN npm install --only=prod
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN npm run build
|
||||
RUN npm run build:client
|
||||
|
||||
EXPOSE 3001
|
||||
|
||||
CMD ["node", "build/server.js"]
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /app/build /usr/share/nginx/html
|
||||
|
||||
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||
@ -1,32 +1,34 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
calcapp:
|
||||
container_name: calcapp
|
||||
client:
|
||||
build: ./EvoCalculator
|
||||
ports:
|
||||
- '3001:3001'
|
||||
depends_on:
|
||||
- calccore
|
||||
restart: always
|
||||
- core
|
||||
networks:
|
||||
vpcbr:
|
||||
ipv4_address: 10.5.0.4
|
||||
- calc_network
|
||||
links:
|
||||
- core
|
||||
|
||||
calccore:
|
||||
container_name: calccore
|
||||
core:
|
||||
build: ./EvoCalculator.Core
|
||||
ports:
|
||||
- '5000:5000'
|
||||
restart: always
|
||||
networks:
|
||||
vpcbr:
|
||||
ipv4_address: 10.5.0.5
|
||||
- calc_network
|
||||
|
||||
proxy:
|
||||
restart: always
|
||||
build: ./EvoCalculator.Proxy
|
||||
ports:
|
||||
- '4000:80'
|
||||
networks:
|
||||
- web
|
||||
- calc_network
|
||||
depends_on:
|
||||
- client
|
||||
links:
|
||||
- client
|
||||
|
||||
networks:
|
||||
vpcbr:
|
||||
calc_network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 10.5.0.0/16
|
||||
web:
|
||||
external: true
|
||||
|
||||
8
nginx.conf
Normal file
8
nginx.conf
Normal file
@ -0,0 +1,8 @@
|
||||
server {
|
||||
listen 3000;
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,6 @@ export default class {
|
||||
axios
|
||||
.post<IGetCalculationResponse>(
|
||||
getServerUrl(
|
||||
'/proxy',
|
||||
CORE_PROXY_URL,
|
||||
'/api',
|
||||
'/v1',
|
||||
|
||||
@ -3,6 +3,6 @@ import { getServerUrl } from 'client/common/urls';
|
||||
import { CRM_PROXY_URL } from 'core/constants/urls';
|
||||
|
||||
export default new ApolloClient({
|
||||
uri: getServerUrl('/proxy', CRM_PROXY_URL),
|
||||
uri: getServerUrl(CRM_PROXY_URL),
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
|
||||
@ -9,5 +9,5 @@ export const CRM_PROXY_URL = '/crmgraphql';
|
||||
export const CORE_URL =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? 'http://localhost:5000'
|
||||
: 'http://calccore:5000';
|
||||
: 'http://core:5000';
|
||||
export const CORE_PROXY_URL = '/core';
|
||||
|
||||
Reference in New Issue
Block a user