polymer-starter-kit icon indicating copy to clipboard operation
polymer-starter-kit copied to clipboard

Docker image for polymer starter kit

Open aahoo opened this issue 10 years ago • 7 comments

Last time I tried installing Polymer on Windows, it was a huge pain in the ... . There are just too many ways for the installation process to fail. I believe that Docker containers could fix this issue. If you guys create an official Docker image for the starter kit, it will make it easier for the newcomers to join and enjoy Polymer.

Edit: This is a nice article about Why You Should Stop Installing Your WebDev Environment Locally

aahoo avatar May 04 '16 15:05 aahoo

What issues did you face?

robdodson avatar May 04 '16 16:05 robdodson

It was a long time ago but I guess it was related to node-gyp.

I am creating my own docker image, but having an official one would make its maintenance easier.

aahoo avatar May 04 '16 16:05 aahoo

I think linking to your docker image would be a better approach. Would you mind sharing a link when it's ready?

robdodson avatar May 04 '16 16:05 robdodson

sure :)

aahoo avatar May 04 '16 16:05 aahoo

This is what I got so far for the Dockerfile. It can be a starting point but it needs docker expert touch.

FROM node:5
MAINTAINER aahoo <?@?.com>
ENV NODE_ENV=development
WORKDIR /psk
RUN git clone https://github.com/PolymerElements/polymer-starter-kit.git /psk
RUN npm install -g gulp bower
RUN npm install
RUN bower install --allow-root
EXPOSE 5000 3001
CMD ["bash"]
  1. build image: docker build --rm=true --force-rm=true -t polymer-starter-kit .
  2. run
    • first time run: docker run -it -p 5000:5000 -p 3001:3001 --name psk polymer-starter-kit
    • following runs: docker start -i psk
  3. gulp serve

Another option for the "first time run" is:

  • docker run -it -p 5000:5000 -p 3001:3001 -v hostDir:containerDir --name psk polymer-starter-kit
  • npm install
  • bower install --allow-root

This allows mounting a host directory to the container. Project files will remain in the host for editing with native OS tools.

With this, everyone can have a quick preview without bothering with installation hassles. More importantly, it is guaranteed to work!

If you want, I can push my image to the Docker Hub. Looking forward to see an official image with all the pro tools installed :)

aahoo avatar May 04 '16 19:05 aahoo

I don't think anyone on our team is planning on building a docker image so yours is probably the best one out there :D I think you should totally publish it to docker hub

robdodson avatar May 05 '16 16:05 robdodson

Here is the image for yeoman + generator-polymer and here is for yeoman which can be extended for other generators. It is extremely convenient for those who have installation issues.

After I read this article (Why You Should Stop Installing Your WebDev Environment Locally) I switched to all my devs to docker.

aahoo avatar May 05 '16 17:05 aahoo