Docker image size for ReactJS

Viewed 183

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 image size in GBs. May I know the reason please?

1 Answers
Related