Anyone doing 2 stage docker build to reduce the image size?



  • Guys,

    I would appreciate any help with reducing Docker image with my quasar app.
    At the moment my dockerfile-dev looks like that:

    FROM node:10-alpine
    ENV NODE_ENV development
    RUN yarn global add @vue/cli && yarn global add quasar-cli
    
    WORKDIR /srv
    EXPOSE 8080
    CMD quasar dev
    

    It is working nice, because together with the volumes set up in docker-compose I have nice hot reloading etc, but I am getting closer to first deployment and I can’t imagine sending/pulling 1.1gb image every time…

    As the result I have 1.2 GB image which is pretty bad… I suppose I would have to go for 2 stage build but I am not that docker expert to do that…



  • why are you building quasar dev in your docker app? That is really for development only. If you want to reduce your size, just use the dist folder as your WORKDIR