jefferyb / docker-polymer-cli

This is image contains a set of necessary tools for Polymer CLI Development
8 stars 9 forks source link

jefferyb/polymer-cli

This is image contains a set of necessary tools for Polymer CLI and Polymer Starter Kit Development so you can get up and running developing with Polymer without installing all the tools on your own computer.

This image is built weekly, with all the latest tools...

What's new:

Supported tags

Build an app with App Toolbox

Using the Polymer Project Documentation:

Initialize & serve your project from a template
===============================================

1. Create a new project folder to start from

    $ mkdir my-app
    $ cd my-app

2. Initialize your project with an app template

    $ docker run --rm -v $(pwd):/home/polymer/app jefferyb/polymer-cli polymer init polymer-2-starter-kit

3. Serve your project

    $ docker run --name polymer-project -d -p 8081:8081 -v $(pwd):/home/polymer/app jefferyb/polymer-cli polymer serve -H 0.0.0.0

    and just point your browser to port 8081

4. When you're done serving your project

    $ docker rm -f polymer-project

How to use this image?

Go to your Polymer project folder, then execute:

docker run --name polymer-project -d -p 8081:8081 -v $(pwd):/home/polymer/app jefferyb/polymer-cli polymer serve -H 0.0.0.0

(It looks like the ports have changed from 8080 to 8081)

Once it's up and running, just point your browser to port 8081...

Quick Tip

Since the docker run command is long, and if you're going to be using it often, I would suggest creating/adding an alias for it in your .bash_profile or .bashrc, like:

alias polymer="docker run --name polymer-project --rm -p 8081:8081 -v $(pwd):/home/polymer/app jefferyb/polymer-cli polymer "

and then you can just use polymer along with the Polymer CLI commands, like:

polymer init starter-kit

to initialize a Polymer project from the starter-kit or one of other several templates, or

polymer serve -H 0.0.0.0

to run a development server that you can reach at port 8081

Polymer-CLI Commands

Polymer-CLI includes a number of tools for working with Polymer and Web Components:

Tools included in this image:

This image includes:

* LTS version (4.x) of Node.js
* git
* gulp
* Bower
* Polymer CLI
* generator-polymer-init-custom-build

And you can make alias for them too to work with your project with something like:

alias git-docker="docker run --rm -v $(pwd):/home/polymer/app jefferyb/polymer-cli git "
alias npm-docker="docker run --rm -v $(pwd):/home/polymer/app jefferyb/polymer-cli npm "
alias node-docker="docker run --rm -v $(pwd):/home/polymer/app jefferyb/polymer-cli node "
alias bower-docker="docker run --rm -v $(pwd):/home/polymer/app jefferyb/polymer-cli bower "
alias gulp-docker="docker run --rm -v $(pwd):/home/polymer/app -p 5000:5000 jefferyb/polymer-cli gulp "

and then, for example, you can use:

git-docker clone https://github.com/PolymerElements/polymer-starter-kit.git
npm-docker install or npm-docker update
bower-docker install or bower-docker update
gulp-docker serve

and just point your browser to port 5000 to get started with Polymer Starter Kit.

Container Shell Access

The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your Polymer project container:

docker exec -it polymer-project bash

If you want to connect as root (for example to install a package), then execute:

docker exec -it -u root polymer-project bash