Dockerfile for React App with Node and Nginx image for deploying on Kubernetes cluster

10/17/2019

I am facing difficulty in creating Dockerfile for My test React app. My goal is to deploy React App into Kubernetes cluster locally. I have successfully used nginx image but facing issue while running my node backend startup file. I can see the UI successfully on my browser but its not connecting properly with Backend. I have used SQL server for database & node for backend.

This is my Dockerfile

#Stage1
FROM node:10
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .

EXPOSE 9005
#CMD [ "node", "index.js" ]




#Stage2
FROM nginx:1.17
COPY view/ /usr/share/nginx/html

CMD  [ "node", "index.js" ]

I have followed this guide for reference. I will really appreciate if you help me.

-- jeetdeveloper
devops
docker
kubernetes
nginx
node.js

0 Answers