Dockerfile 588 B

123456789101112131415161718192021222324252627
  1. FROM node:13.13.0-stretch-slim
  2. #Argument that is passed from docer-compose.yaml file
  3. ARG NODE_PORT
  4. #Echo the argument to check passed argument loaded here correctly
  5. RUN echo "Argument port is : $NODE_PORT"
  6. # Create app directory
  7. WORKDIR /usr/src/app
  8. #COPY . .
  9. COPY . .
  10. # Install app dependencies
  11. # A wildcard is used to ensure both package.json AND package-lock.json are copied
  12. # where available (npm@5+)
  13. RUN npm install
  14. #In my case my app binds to port NODE_PORT so you'll use the EXPOSE instruction to have it mapped by the docker daemon:
  15. EXPOSE ${NODE_PORT}
  16. CMD npm run dev