FROM node:12.4.0-alpine as dev

RUN mkdir /work/
WORKDIR /work/

COPY ./src/package.json /work/package.json
RUN npm install
RUN npm install -g nodemon

COPY ./src/ /work/src/

# ENTRYPOINT [ "nodemon", "--inspect=0.0.0.0:9229", "./src/server.js" ]
# ENTRYPOINT [ "/usr/bin/top" ]
CMD top

###########START NEW IMAGE###################

FROM node:12.4.0-alpine as prod

WORKDIR /work/
COPY ./src/package.json /work/package.json
RUN npm install
COPY ./src/ /work/

CMD node .