Docker container install -g copy to other container

时间:2019-03-19 14:53:04

标签: node.js docker express

I am installing Express in a container. I need the smallest development container and I am using a full container to install the dependencies

        # container to install dendencies
        FROM node:10 as installer
        WORKDIR /src
        COPY package.json package-lock.json ./
        # install all dependencies
        RUN npm install
        # i need nodemon as global
        RUN npm install -g nodemon

        # working container 
        FROM node:10-alpine
        RUN mkdir /src
        WORKDIR /src
        # copy everything (node_modules)
        COPY --from=installer /src .
        COPY . .
        EXPOSE 3000
        CMD ["nodemon", "start"]
  1. I copied all the node_modules but how can I copy the global -g nodemon ?
  2. How can I remove the "installer" container after the installation process?

0 个答案:

没有答案