amsdard/grunt

By amsdard

Updated over 8 years ago

FROM node RUN npm install -g grunt-cli

Image
0

141

nodeJS, grunt

features

  • using Your local SSH key
  • store cache files locally
  • node works as Your local user (thanks to "UID mapping")

UID mapping

Docker's node works as "nodejs" user. After mapping Your local directory with project into docker's /opt, entrypoint load UID of /opt and replace UID of "nodejs" user to new value. The result is working as Your local user (no "permission denied" errors)

build

  • Create Makefile in Your project
CMD=$(filter-out $@,$(MAKECMDGOALS))
ip: ; @docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CMD}
npm: ; @docker run --rm -it \
           -v ~/.ssh/:/home/nodejs/.ssh \
           -v ~/.docker-npm/:/home/nodejs/.npm \
           -v $$(pwd)/:/opt \
           amsdard/grunt ${CMD}
grunt: ; @make npm CMD="grunt ${CMD}"
%: ; @:
  • set up /home/nodejs/.ssh docker's location to use Your local SSH keys
  • set up /home/nodejs/.npm docker's npm cache directory
  • set up /opt docker's location as main project directory (with composer.json)

run

make npm
make grunt build
make grunt CMD="--help"

Docker Pull Command

docker pull amsdard/grunt