Category : reactjs

I’m using following Dockerfile for ReactJS application: FROM node:latest WORKDIR /app COPY package*.json ./ RUN npm install COPY . ./ RUN npm run build RUN npm install -g serve RUN rm -rf node_modules EXPOSE 3000 CMD ["serve", "-s", "build"] I’m installing node_modules, but I’m deleting node_modules after I run the npm run build. But still ..

Read more

In most of Dockerfile for ReactJS application, I see that two COPY instructions. One is to copy package.json and after installing node_modules, another COPY instruction to copy source code. Ex: FROM node:alpine WORKDIR ‘/app’ COPY package.json . RUN npm install COPY . . CMD ["npm", "run", "start"] Can’t we do with just one COPY command? ..

Read more