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.
- Set up Docker on Mac OS X.
- Open the Docker CLI from within Kitematic
Then change the directory to the
yeoman-dockerfolder in this project's root:
my-repositorywith project's root. This folder should contain a file named
Build the docker image with the following command:
docker build .
The output of this command should look like this.
- Once the docker image has built, run it:
docker run -dit my-image-hash
my-image-hashwith the unique identifier that docker gave to your image after building it e.g.
- Sync your project's root folder to the docker container's shared volume with Kitematic
- Map the docker container ports to the docker host. In this docker container, ports
3001are exposed. Port
3000is where browser sync serves the site, and port
3001is 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
3000on the docker container maps to the IP address and port
192.168.99.100:3000in Kitematic, and port
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.
- Shell into the docker container.
- serve the site with the following command:
- 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.
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 installon 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!