Public | Automated Build

Last pushed: a year ago
Short Description
Yeoman inside a docker container, with NPM packages installed into a non-root container.
Full Description

Dockerized-Yeoman

This dockerfile builds a container with yeoman, generator-gulp-angular. I wrote this dockerfile because yeoman does not run as the root, and default docker containers run executables as root. This means that if you spin up a docker container and then try to run yeoman, it will fail.

Installation

  1. Set up Docker on Mac OS X.
  2. Open the Docker CLI from within Kitematic
  3. Then change the directory to the yeoman-docker folder in this project's root:

    cd ~/my-repository/yeoman-docker
    

    Replace my-repository with project's root. This folder should contain a file named dockerfile.

  4. Build the docker image with the following command:

    docker build .
    

    The output of this command should look like this.

  5. Once the docker image has built, run it:
    docker run -dit my-image-hash
    
    Replace my-image-hash with the unique identifier that docker gave to your image after building it e.g. fa817ac6674d.

Usage

  1. Sync your project's root folder to the docker container's shared volume with Kitematic
  2. Map the docker container ports to the docker host. In this docker container, ports 3000 and 3001 are exposed. Port 3000 is where browser sync serves the site, and port 3001 is where it serves its own control panel. To keep things simple, you might want to map the port on the docker container to the same port number in Kitematic, i.e. port 3000 on the docker container maps to the IP address and port 192.168.99.100:3000 in Kitematic, and port 3001 maps to 192.168.99.100:3001. However, if those ports are already mapped to another application, such as a MongoDB server or docker container, you can map them to whatever available ports you have.
  3. Shell into the docker container.
  4. serve the site with the following command:
    gulp serve
    
  5. Find the IP Address to which the site is being served in kitematic, and enter it into your browser’s URL bar to navigate to the running site.

Roadmap

This is not a full-fledged project with semantic versioning. However, I might add the following features later if it is convenient for me:

  • bash completions
  • automatically run npm install && bower install on container startup as yeoman user, before dropping to a shell.

If you take the time to add these features, just send me a PR and I’ll merge them in!

Docker Pull Command
Owner
designbyajay
Source Repository