Skip to content

Instantly share code, notes, and snippets.

@chazcheadle
Created October 5, 2016 04:24
Show Gist options
  • Save chazcheadle/944a258f0952e7820aacd6a0b227eea2 to your computer and use it in GitHub Desktop.
Save chazcheadle/944a258f0952e7820aacd6a0b227eea2 to your computer and use it in GitHub Desktop.
Build a Node 4.4.4 factory for Docker
# Create a factory container that can run a specific version of NodeJS/npm/grunt/bower/gulp
FROM centos:7
# Install any required system programs. In this case, 'wget' is is required for fetching the binaries.
RUN yum install -y wget
# Download specific version of NodeJS and install it on the system..
RUN cd /opt; mkdir node-4.4.4; wget http://nodejs.org/dist/v4.4.4/node-v4.4.4-linux-x64.tar.gz; \
tar zxvf node-v4.4.4-linux-x64.tar.gz --strip-components=1 -C ./node-4.4.4; rm -f node-v4.4.4-linux-x64.tar.gz; \
ln -s /opt/node-4.4.4/bin/node /usr/local/bin/node; \
ln -s /opt/node-4.4.4/bin/npm /usr/local/bin/npm
# Install Bower, Gulp and Grunt.
RUN npm install -g bower gulp-cli grunt-cli
## To use:
# You can run this docker container on a volume that contains your package.json, gulpfile.js etc.
# ex: sudo docker run --rm -it --name node-factory \
# -v /var/www/app:/app -w /app node-factory:4.4.4 \
# npm install # or gulp, or bower install, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment