Dockerfile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # This is to build a container that demos the Mol* canvas app
  2. # Source material: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
  3. # Source material: https://derickbailey.com/2017/05/31/how-a-650mb-node-js-image-for-docker-uses-less-space-than-a-50mb-image/
  4. # Source material: https://hub.docker.com/_/node/
  5. # Use the slimed NodeJS source, yielding a space savings of 600MB (~66% of total)
  6. FROM node:alpine
  7. # Create app directory
  8. WORKDIR /usr/src/app
  9. # Install app dependencies
  10. # A wildcard is used to ensure both package.json AND package-lock.json AND tslint.json AND tsconfig.json are copied
  11. # where available (npm@5+)
  12. COPY *.json ./
  13. # Install all dependencies and copy results
  14. RUN npm install
  15. COPY . .
  16. # Build library and canvas application then copy results
  17. RUN npm run build
  18. RUN npm run build-canvas
  19. COPY build/canvas/ build/canvas/
  20. # Open ports for HTTP
  21. EXPOSE 8080/tcp
  22. # Setup standalone simple webserver to run the demo
  23. RUN npm install http-server -g
  24. # Start NodeJS at container stand up
  25. CMD [ "http-server", "build/canvas/", "-p", "8080" ]
  26. # Developer helpers (what is inside this container?)
  27. RUN node -v
  28. RUN ls -alh