React App Docker hosting - pavangayakwad/scripts GitHub Wiki

FROM node:14.14.0-alpine3.11

WORKDIR /app

COPY package.json ./

RUN npm install

RUN npm install -g react-scripts

ADD src ./src

ADD public ./public

CMD ["npm", "start"]

FROM nginx:latest

COPY ./build /usr/share/nginx/html

save above content in the file called "Dockerfile" (yes, no extension) and then run below command to build a docker image

docker build -t my-app .