If you want to be able to run gulp/npm as if it was installed on your host locally, you can define the following function in your ~/.bashrc, ~/.zshrc or similar. Also do "source ~/.bashrc", "source ~/.zshrc" or reload the terminal.
# Folder mount ignore hack: "--volume /app/.git" will create empty folder in Docker although it's
# not on host.
# Credits: https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder#answer-37898591
gulp () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
-t \
--user $(id -u):$(id -g) \
--volume /app/.git/ \
--volume /private/etc/passwd:/etc/passwd:ro \
--volume /private/etc/group:/etc/group:ro \
--volume $(pwd)/:/app/:cached \
hkirsman/wunder-nodejs-gulp gulp "$@"
}
npm () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /app/.git/ \
--volume /private/etc/passwd:/etc/passwd:ro \
--volume /private/etc/group:/etc/group:ro \
--volume $(pwd)/:/app/:cached \
--volume ~/.npm/:/npm-cache/:cached \
hkirsman/wunder-nodejs-gulp npm "$@"
}
Content type
Image
Digest
Size
85.1 MB
Last updated
over 8 years ago
docker pull hkirsman/wunder-nodejs-gulp