Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # This is to build a container that demos the Molstar Canvas prototype
  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 application and bundle results
  17. RUN npm run build
  18. COPY build/ build/
  19. # Build Canvas application and bundle results
  20. RUN npm run build-canvas
  21. COPY build/ build/
  22. # Open ports for HTTP
  23. EXPOSE 8080/tcp
  24. # Setup standalone simple webserver to run the demo
  25. RUN npm install http-server -g
  26. # Start NodeJS at container stand up
  27. CMD [ "http-server", "build/canvas/", "-p", "8080" ]
  28. # Developer helpers (what is inside this container?)
  29. RUN node -v
  30. RUN ls -alh