├── _config.yml ├── test ├── resources │ ├── md │ │ └── index.md │ ├── gulpfile.js │ ├── Gruntfile.js │ ├── bower.json │ └── package.json ├── lib │ ├── assert.sh │ ├── list-changes.sh │ ├── execute-tests.sh │ ├── deploy.sh │ ├── travis.sh │ └── add-tests.sh ├── node.sh ├── bower.sh ├── md.sh ├── yarn.sh ├── npm.sh ├── gulp.sh ├── grunt.sh ├── npx.sh ├── run-tests.sh ├── install.sh └── 1.build.sh ├── .gitignore ├── node-10-alpine ├── .image-tags └── Dockerfile ├── node-10-debian ├── .image-tags └── Dockerfile ├── node-11-alpine ├── .image-tags └── Dockerfile ├── node-11-debian ├── .image-tags └── Dockerfile ├── node-6-alpine ├── .image-tags └── Dockerfile ├── node-7-alpine ├── .image-tags └── Dockerfile ├── node-7-debian ├── .image-tags └── Dockerfile ├── node-8-alpine ├── .image-tags └── Dockerfile ├── node-8-debian ├── .image-tags └── Dockerfile ├── node-9-alpine ├── .image-tags └── Dockerfile ├── node-9-debian ├── .image-tags └── Dockerfile ├── node-debian ├── .image-tags └── Dockerfile ├── node-6.9-alpine ├── .image-tags └── Dockerfile ├── node-6.9-debian ├── .image-tags └── Dockerfile ├── node-7.0-debian ├── .image-tags └── Dockerfile ├── node-alpine ├── .image-tags └── Dockerfile ├── node-7.7-alpine ├── .image-tags └── Dockerfile ├── bin ├── yarn ├── gulp ├── node ├── npm ├── npx ├── grunt ├── generate-md ├── bower └── install.sh ├── .travis.yml ├── LICENSE └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /test/resources/md/index.md: -------------------------------------------------------------------------------- 1 | # Readme to HTML 2 | 3 | It worked 4 | -------------------------------------------------------------------------------- /test/resources/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | 3 | gulp.task('default', function(done) { 4 | console.log('Hello world.'); 5 | done(); 6 | }); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | test/resources/bower_components 2 | test/resources/node_modeules 3 | test/resources/html 4 | test/bin 5 | test/**/*.lock 6 | test/**/package-lock.json 7 | wiki/ 8 | -------------------------------------------------------------------------------- /node-10-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-10-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-10-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-10-debian' 6 | ) 7 | -------------------------------------------------------------------------------- /node-11-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-11-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-11-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-11-debian' 6 | ) 7 | -------------------------------------------------------------------------------- /node-6-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-6-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-7-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-7-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-7-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-7-debian' 6 | ) 7 | -------------------------------------------------------------------------------- /node-8-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-8-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-8-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-8-debian' 6 | ) 7 | -------------------------------------------------------------------------------- /node-9-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-9-alpine' 6 | ) 7 | -------------------------------------------------------------------------------- /node-9-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-9-debian' 6 | ) 7 | -------------------------------------------------------------------------------- /test/resources/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | grunt.initConfig(); 3 | grunt.registerTask('default', []); 4 | console.log('hello world'); 5 | }; 6 | -------------------------------------------------------------------------------- /node-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'debian' 6 | 'node-debian' 7 | ) 8 | -------------------------------------------------------------------------------- /node-6.9-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-6.9-alpine' 6 | '6.9-alpine' 7 | ) 8 | -------------------------------------------------------------------------------- /node-6.9-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-6.9-debian' 6 | '6.9-debian' 7 | ) 8 | -------------------------------------------------------------------------------- /node-7.0-debian/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-7.0-debian' 6 | '7.0-debian' 7 | ) 8 | -------------------------------------------------------------------------------- /node-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'latest' 6 | 'alpine' 7 | 'node-alpine' 8 | ) 9 | -------------------------------------------------------------------------------- /node-7.7-alpine/.image-tags: -------------------------------------------------------------------------------- 1 | # This file is used to define which image tags are triggered for build in CI 2 | # deployments 3 | 4 | declare -a TAGS=( 5 | 'node-7.7-alpine' 6 | '7.0-alpine' # This is due to the tag being mistakenly upgraded over time 7 | # Kept for stability for current users 8 | ) 9 | -------------------------------------------------------------------------------- /test/lib/assert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function assert { 4 | script=$1 5 | 6 | expected=0 7 | if [ "" != "$2" ]; then 8 | expected=$2 9 | fi 10 | 11 | # 12 | bash $(dirname `pwd`)/test/$script; 13 | result=$? 14 | echo " expected: $expected, result: $result" 15 | exit $result 16 | } -------------------------------------------------------------------------------- /test/node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/node" 10 | 11 | $CMD --version 12 | result=$? 13 | if [ 0 -ne $result ]; then 14 | echo "${PREFIX}command failed: '$CMD --version'" 15 | fi 16 | 17 | exit $result 18 | -------------------------------------------------------------------------------- /test/lib/list-changes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function list_changes() { 3 | grep_str=".*" 4 | if [ "" != "$1" ]; then 5 | grep_str="$1" 6 | fi 7 | 8 | if [ "" != "$CURRENT_BRANCH" ] && [ "master" != "$CURRENT_BRANCH" ]; then 9 | git diff --name-only master | grep "$grep_str" 10 | else 11 | git --no-pager diff --name-only $(git log -2 --format='%H') | grep "$grep_str" 12 | fi 13 | } -------------------------------------------------------------------------------- /test/resources/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker-npm", 3 | "description": "NPM image that can execute bower", 4 | "main": "", 5 | "license": "MIT", 6 | "homepage": "", 7 | "private": true, 8 | "ignore": [ 9 | "**/.*", 10 | "node_modules", 11 | "bower_components", 12 | "test", 13 | "tests" 14 | ], 15 | "dependencies": { 16 | "jquery": "^3.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/resources/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project", 3 | "version": "0.0.1", 4 | "description": "Docker image testing", 5 | "license": "MIT", 6 | "private": true, 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/mkenney/docker-npm" 10 | }, 11 | "resolutions": { 12 | "natives": "1.1.3" 13 | }, 14 | "dependencies": { 15 | "grunt": "*", 16 | "gulp": "*" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/lib/execute-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Execute all the requested tests 4 | function execute_tests() { 5 | echo " 6 | Executing tests... ${TESTS[@]}" 7 | 8 | for test in "${!TESTS[@]}"; do 9 | echo " 10 | Executing test '${TESTS[test]}'..." 11 | bash $(dirname `pwd`)/test/${TESTS[test]}.sh 12 | result=$? 13 | if [ 0 -ne $result ]; then 14 | echo "failure (#$result)" 15 | exit 1 16 | else 17 | echo " 18 | success" 19 | fi 20 | done 21 | } 22 | -------------------------------------------------------------------------------- /test/bower.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/bower --allow-root" 10 | 11 | cd $PROJECT_PATH/test/resources 12 | rm -rf bower_components 13 | 14 | $CMD install 15 | result=$? 16 | if [ 0 -ne $result ]; then 17 | echo "${PREFIX}command failed: '$CMD install'" 18 | exit $result 19 | fi 20 | 21 | ls bower_components 22 | result=$? 23 | if [ 0 -ne $result ]; then 24 | echo "${PREFIX}${PREFIX}${output}" 25 | fi 26 | rm -rf bower_components 27 | 28 | exit $result 29 | -------------------------------------------------------------------------------- /test/md.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/generate-md" 10 | 11 | cd $PROJECT_PATH/test/resources 12 | rm -rf html 13 | 14 | $CMD --input md --output html > /dev/null >&1 15 | result=$? 16 | if [ 0 -ne $result ]; then 17 | echo "${PREFIX}command failed: '$CMD'" 18 | exit $result 19 | fi 20 | 21 | ls $PROJECT_PATH/test/resources/html 22 | result=$? 23 | if [ 0 -ne $result ]; then 24 | echo "${PREFIX}command failed: 'ls html'" 25 | fi 26 | 27 | exit $result 28 | -------------------------------------------------------------------------------- /test/yarn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/yarn" 10 | 11 | cd $PROJECT_PATH/test/resources 12 | rm -rf node_modules 13 | rm -f yarn.lock 14 | 15 | $CMD install 16 | result=$? 17 | if [ 0 -ne $result ]; then 18 | echo "${PREFIX}command failed: '$CMD install'" 19 | exit $result 20 | fi 21 | 22 | ls node_modules 23 | result=$? 24 | if [ 0 -ne $result ]; then 25 | echo "${PREFIX}command failed: 'ls node_modules'" 26 | fi 27 | rm -rf node_modules 28 | rm -f yarn.lock 29 | 30 | exit $result 31 | -------------------------------------------------------------------------------- /test/npm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/npm" 10 | 11 | cd $PROJECT_PATH/test/resources 12 | rm -rf node_modules 13 | rm -f package.lock 14 | 15 | $CMD install 16 | result=$? 17 | if [ 0 -ne $result ]; then 18 | echo "${PREFIX}command failed: '$CMD install'" 19 | exit $result 20 | fi 21 | 22 | ls node_modules 23 | result=$? 24 | if [ 0 -ne $result ]; then 25 | echo "${PREFIX}command failed: 'ls node_modules'" 26 | fi 27 | rm -rf node_modules 28 | rm -f package.lock 29 | 30 | exit $result 31 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=yarn 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm -$term_type \ 21 | -v $(pwd):/src:rw \ 22 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 23 | -v $HOME/.npm:/home/dev/.npm:rw \ 24 | $DOCKER_NPM_ARGS \ 25 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 26 | fi 27 | -------------------------------------------------------------------------------- /bin/gulp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=gulp 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /bin/node: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=node 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /bin/npm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=npm 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /bin/npx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=npx 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /test/gulp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | YARN="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/yarn" 10 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/gulp" 11 | 12 | cd $PROJECT_PATH/test/resources 13 | rm -rf node_modules 14 | rm -f package.lock 15 | $YARN install 16 | 17 | result=$? 18 | if [ 0 -ne $result ]; then 19 | echo "${PREFIX}command failed: '$YARN install'" 20 | exit $result 21 | fi 22 | 23 | $CMD 24 | result=$? 25 | if [ 0 -ne $result ]; then 26 | echo "${PREFIX}command failed: '$CMD'" 27 | fi 28 | rm -rf node_modules 29 | rm -f package.lock 30 | 31 | exit $result 32 | -------------------------------------------------------------------------------- /bin/grunt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=grunt 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /test/grunt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | YARN="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/yarn" 10 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/grunt" 11 | 12 | cd $PROJECT_PATH/test/resources 13 | rm -rf node_modules 14 | rm -f package.lock 15 | $YARN install 16 | 17 | result=$? 18 | if [ 0 -ne $result ]; then 19 | echo "${PREFIX}command failed: '$YARN install'" 20 | exit $result 21 | fi 22 | 23 | $CMD 24 | result=$? 25 | if [ 0 -ne $result ]; then 26 | echo "${PREFIX}command failed: '$CMD'" 27 | fi 28 | rm -rf node_modules 29 | rm -f package.lock 30 | 31 | exit $result 32 | -------------------------------------------------------------------------------- /test/npx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PREFIX=" " 4 | IMAGE_TAG=latest 5 | if [ "" != "$1" ]; then 6 | IMAGE_TAG=$1 7 | fi 8 | 9 | YARN="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/yarn" 10 | CMD="docker run --rm -ti -v $PROJECT_PATH/test/resources:/src:rw mkenney/npm:$IMAGE_TAG /usr/local/bin/npx" 11 | 12 | cd $PROJECT_PATH/test/resources 13 | rm -rf node_modules 14 | rm -f package.lock 15 | $YARN install 16 | 17 | result=$? 18 | if [ 0 -ne $result ]; then 19 | echo "${PREFIX}command failed: '$YARN install'" 20 | exit $result 21 | fi 22 | 23 | $CMD gulp 24 | result=$? 25 | if [ 0 -ne $result ]; then 26 | echo "${PREFIX}command failed: '$CMD'" 27 | fi 28 | rm -rf node_modules 29 | rm -f package.lock 30 | 31 | exit $result 32 | -------------------------------------------------------------------------------- /bin/generate-md: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=generate-md 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $TAG $(dirname $0) 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT $@ 27 | fi 28 | -------------------------------------------------------------------------------- /bin/bower: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TAG=node-11-alpine 4 | if [ "" != "$DOCKER_NPM_TAG" ]; then 5 | TAG="$DOCKER_NPM_TAG" 6 | fi 7 | SCRIPT=bower 8 | INSTALL_SCRIPT=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 9 | 10 | if [ "self-update" = "$1" ]; then 11 | docker pull mkenney/npm:$TAG 12 | curl -f -L -s $INSTALL_SCRIPT | sh -s $SCRIPT $(dirname $0) && exit 0 13 | else 14 | if [ -t 0 ]; then 15 | term_type=ti 16 | else 17 | term_type=i 18 | fi 19 | docker run \ 20 | --rm \ 21 | -$term_type \ 22 | -v $(pwd):/src:rw \ 23 | -v $HOME/.ssh:/home/dev/.ssh:ro \ 24 | -v $HOME/.npm:/home/dev/.npm:rw \ 25 | $DOCKER_NPM_ARGS \ 26 | mkenney/npm:$TAG /usr/local/bin/$SCRIPT --allow-root $@ 27 | fi 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | language: javascript 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | notifications: 10 | slack: 11 | secure: tgQIiODFrpQ3pUCMTCPfmG+UmI+G04uMplkeomH6qKAPvfB003lf4Dt6Z0Fr0khdAxNa+bbOmaKCF3BLyJ6gcWT9fZAYeXyz0Dk3tzEjhihWwDxoRUJRoY5XldoHyeWo4fXw3tfQE6DWZ9ixyfWKMNaCx7At6cwMl/AMgDrQfm2UDS/MxYiWMMDW920vABDV9DSfsvrkC+6tcHYCOnjwS27R9Z0rDfeykJ2zKBDdgh7Em1/TX8z/pr1FJk1oVrVjOrUoNu729Jn/PfVkMSAAuWwpIk6iMzBr6dVuj6qVlYENMiwBJJ+7J5ERrCxbi6JbKJf8WRhc36nVHzz/X9onHaTzgBCDNAHtWWjm15Krb0HXeSkLcXi+GEsllJDCAVriwRpGAre/QUZHzIk2jCQUfOiiVrsyE2yJjPMJ3Zpa23oYKWA8nh/51BQoa9lL3TgZFUxqqtK2RU4ZSMDDdiLhQr5LhFPlMzPIKfYvV3Cqdg74jcq9WnWq4DFyCCfh7Kd5g5P6tAEV10wx+XHkfbczgd/KWFs7S8mo8qE7b7sAnJpgDH3B//4h2TVzZRw1BWrysdzH0O4uTBVfr3Lh0SiRschAW5uNBSHBaEN/N7IBuDNoMMPEiqoLeYLVnIVqHOvBVWkxkU6HxE/iW412Xf2CDTrQyWIlaSlnIphf4bZf8y0= 12 | 13 | services: 14 | - docker 15 | 16 | before_install: 17 | 18 | script: 19 | - cd test 20 | - ./run-tests.sh 21 | -------------------------------------------------------------------------------- /test/lib/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash bash 2 | 3 | function deploy() { 4 | if [ "false" == "$TRAVIS" ]; then 5 | echo "Release builds can only be triggered within the CI environment, skipping for Dockerfile '$1'" 6 | 7 | elif [ "false" != "$TRAVIS_PULL_REQUEST" ]; then 8 | echo "Release builds cannot be triggered for pull requests, skipping for Dockerfile '$1'" 9 | 10 | else 11 | echo "Triggering release builds for Dockerfile '$1'" 12 | source $PROJECT_PATH/$1/.image-tags 13 | for tag in "${TAGS[@]}"; do 14 | echo " - $tag" 15 | curl \ 16 | -H "Content-Type: application/json" \ 17 | --data "{\"docker_tag\": \"$tag\"}" \ 18 | -X POST \ 19 | "https://registry.hub.docker.com/u/mkenney/npm/trigger/$DOCKER_TOKEN/" 20 | 21 | # Because Docker Hub throttles API calls a bit heavily 22 | sleep 45 23 | done 24 | fi 25 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Michael Kenney 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/lib/travis.sh: -------------------------------------------------------------------------------- 1 | if [ "true" != "$TRAVIS" ]; then 2 | # assume dev testing 3 | 4 | # Get the current and parent branch names 5 | # based on https://gist.github.com/intel352/9761288#gistcomment-1774649 6 | vbc_col=$(( $(git show-branch | grep '^[^\[]*\*' | head -1 | cut -d* -f1 | wc -c) - 1 )) 7 | swimming_lane_start_row=$(( $(git show-branch | grep -n "^[\-]*$" | cut -d: -f1) + 1 )) 8 | TRAVIS_BRANCH=`git show-branch | tail -n +$swimming_lane_start_row | grep -v "^[^\[]*\[$CURRENT_BRANCH" | grep "^.\{$vbc_col\}[^ ]" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'` 9 | if [ "" == "$TRAVIS_BRANCH" ]; then TRAVIS_BRANCH=master; fi 10 | export TRAVIS_BRANCH 11 | 12 | export TRAVIS=false 13 | export TRAVIS_PULL_REQUEST=false 14 | fi 15 | 16 | if [ "false" == "$TRAVIS_PULL_REQUEST" ]; then 17 | TRAVIS_PULL_REQUEST_BRANCH=`git rev-parse --abbrev-ref HEAD` 18 | if [ "HEAD" == "$TRAVIS_PULL_REQUEST_BRANCH" ]; then 19 | TRAVIS_PULL_REQUEST_BRANCH=master 20 | fi 21 | export TRAVIS_PULL_REQUEST_BRANCH 22 | fi 23 | 24 | DOCKER_NPM_TAG=latest 25 | if [ "true" == "$TRAVIS" ]; then 26 | DOCKER_NPM_TAG=ci-build 27 | fi 28 | 29 | export CURRENT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH 30 | export PARENT_BRANCH=$TRAVIS_BRANCH 31 | export DOCKER_NPM_TAG 32 | -------------------------------------------------------------------------------- /test/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PROJECT_PATH=$(dirname `pwd`) 4 | 5 | 6 | # Test execution methods 7 | source $PROJECT_PATH/test/lib/add-tests.sh 8 | source $PROJECT_PATH/test/lib/assert.sh 9 | source $PROJECT_PATH/test/lib/deploy.sh 10 | source $PROJECT_PATH/test/lib/execute-tests.sh 11 | source $PROJECT_PATH/test/lib/list-changes.sh 12 | source $PROJECT_PATH/test/lib/travis.sh 13 | 14 | verbose= 15 | if [ "-v" == "$1" ]; then 16 | verbose=-v 17 | shift 18 | fi 19 | 20 | #sh ./node.sh > /dev/null 2>&1 # This should make it pull 21 | 22 | echo " 23 | Analyzing changes: $CURRENT_BRANCH <=> $PARENT_BRANCH 24 | " 25 | 26 | run_tests= 27 | if [ "" != "$1" ]; then 28 | add_tests $1 29 | else 30 | test_found=0 31 | for file in $(list_changes); do 32 | add_tests $file 33 | test_found=1 34 | done 35 | fi 36 | 37 | if [ "true" == "$TRAVIS" ]; then 38 | if [ "$CURRENT_BRANCH" == "$PARENT_BRANCH" ] || [ "0" == "$test_found" ] || [ "false" == $TRAVIS_PULL_REQUEST ]; then 39 | add_tests release 40 | fi 41 | fi 42 | 43 | execute_tests 44 | exit_code=$TEST_EXIT_CODE 45 | 46 | echo " 47 | bower --version: $($PROJECT_PATH/bin/bower --version) 48 | generate-md --version: $($PROJECT_PATH/bin/generate-md --version) 49 | grunt --version: $($PROJECT_PATH/bin/grunt --version) 50 | gulp --version: $($PROJECT_PATH/bin/gulp --version) 51 | node --version: $($PROJECT_PATH/bin/node --version) 52 | npm --version: $($PROJECT_PATH/bin/npm --version) 53 | npx --version: $($PROJECT_PATH/bin/npx --version) 54 | yarn --version: $($PROJECT_PATH/bin/yarn --version) 55 | " 56 | 57 | for dockerfile in $(list_changes Dockerfile); do 58 | if [ -f $PROJECT_PATH/$dockerfile ]; then 59 | echo " ...$(deploy $(dirname $dockerfile))" 60 | fi 61 | done 62 | 63 | exit $exit_code 64 | -------------------------------------------------------------------------------- /test/lib/add-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # List of tests to execute 4 | declare -a TESTS=() 5 | 6 | # Don't add duplicates. Keep list sorted by test name. 7 | add_tests() { 8 | echo " Adding '$1' test suite..." 9 | case $1 in 10 | release) 11 | tests="1.build;install;bower;md;grunt;gulp;node;npm;npx;yarn" 12 | ;; 13 | node-alpine/*|node-debian/*|node-11-alpine/*|node-11-debian/*|node-10-alpine/*|node-10-debian/*|node-9-alpine/*|node-9-debian/*|node-8-alpine/*|node-8-debian/*|node-7-alpine/*|node-7-debian/*|node-7.7-alpine/*|node-7.0-debian/*|node-6.9-alpine/*|node-6.9-debian/*|node-6-alpine/*|node-6-debian/*) 14 | tests="1.build" 15 | ;; 16 | .travis.yml) 17 | tests="install;bower;md;grunt;gulp;node;npm;npx;yarn" 18 | ;; 19 | bin/bower|test/resources/bower.json) 20 | tests="bower" 21 | ;; 22 | bin/generate-md|test/resources/md/index.md) 23 | tests="md" 24 | ;; 25 | bin/grunt|test/resources/Gruntfile.js) 26 | tests="grunt" 27 | ;; 28 | bin/gulp|test/resources/gulpfile.js) 29 | tests="gulp" 30 | ;; 31 | bin/install.sh) 32 | tests="install" 33 | ;; 34 | bin/node) 35 | tests="node" 36 | ;; 37 | bin/npm) 38 | tests="npm" 39 | ;; 40 | bin/npx) 41 | tests="npx" 42 | ;; 43 | bin/yarn) 44 | tests="yarn" 45 | ;; 46 | test/resources/package.json) 47 | tests="npm;yarn" 48 | ;; 49 | esac 50 | 51 | set -f 52 | array=(${tests//;/ }) 53 | for new_test in "${!array[@]}"; do 54 | echo " - '${array[new_test]}'" 55 | is_current_test=0 56 | for current_test in "${!TESTS[@]}"; do 57 | if [ "${TESTS[current_test]}" == "${array[new_test]}" ]; then 58 | is_current_test=1 59 | fi 60 | done 61 | if [ 0 -eq $is_current_test ]; then 62 | TESTS+=("${array[new_test]}") 63 | fi 64 | done 65 | echo 66 | 67 | # Sort 68 | TESTS=( 69 | $(for a in "${TESTS[@]}" 70 | do 71 | echo "$a" 72 | done | sort) 73 | ) 74 | } 75 | -------------------------------------------------------------------------------- /test/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | INSTALL_PATH=bin 4 | PREFIX=" " 5 | 6 | # storage 7 | mkdir -p $INSTALL_PATH 8 | rm -f $INSTALL_PATH/* 9 | 10 | function test_script { 11 | local script=$1 12 | 13 | # Test script 14 | output=$(DOCKER_NPM_TAG=latest $script --version) 15 | result=$? 16 | echo "${PREFIX} $script --version: $output" 17 | if [ "0" != "$result" ]; then 18 | exit $result 19 | fi 20 | } 21 | 22 | function test_install { 23 | local script=$1 24 | local path=$2 25 | 26 | echo "${PREFIX}Testing $script" 27 | 28 | # Test local 29 | rm -f $PROJECT_PATH/test/$path/$script 30 | echo "${PREFIX} bash install.sh $script $path" 31 | output=$(bash $(dirname `pwd`)/bin/install.sh $script $PROJECT_PATH/test/$path) 32 | result=$? 33 | if [ "0" != "$result" ] || [ "" == "$(echo "$output" | grep -i "installation succeeded")" ]; then 34 | echo $output 35 | exit $result 36 | fi 37 | test_script $PROJECT_PATH/test/$path/$script; result=$?; if [ "0" != "$result" ]; then exit $result; fi 38 | 39 | # Test cat 40 | rm -f $PROJECT_PATH/test/$path/$script 41 | echo "${PREFIX} cat install.sh | bash -s $script $path" 42 | output=$(cat $(dirname `pwd`)/bin/install.sh | bash -s $script $PROJECT_PATH/test/$path) 43 | result=$? 44 | if [ "0" != "$result" ] || [ "" == "$(echo "$output" | grep -i "installation succeeded")" ]; then 45 | echo $output 46 | exit $result 47 | fi 48 | test_script $PROJECT_PATH/test/$path/$script; result=$?; if [ "0" != "$result" ]; then exit $result; fi 49 | 50 | # Test remote 51 | rm -f $PROJECT_PATH/test/$path/$script 52 | echo "${PREFIX} curl install.sh | bash -s $script $path" 53 | output=$(curl -f -L -s https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh | bash -s $script $PROJECT_PATH/test/$path) 54 | result=$? 55 | if [ "0" != "$result" ] || [ "" == "$(echo "$output" | grep -i "installation succeeded")" ]; then 56 | echo $output 57 | exit $result 58 | fi 59 | test_script $PROJECT_PATH/test/$path/$script; result=$?; if [ "0" != "$result" ]; then exit $result; fi 60 | } 61 | 62 | error_count=0 63 | test_install bower $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 64 | test_install generate-md $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 65 | test_install grunt $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 66 | test_install gulp $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 67 | test_install node $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 68 | test_install npm $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 69 | test_install npx $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 70 | test_install yarn $INSTALL_PATH; result=$?; if [ "0" != "$result" ]; then error_count=$error_count+1; fi 71 | 72 | echo 73 | echo "errors: $error_count" 74 | exit $error_count 75 | -------------------------------------------------------------------------------- /node-8-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:8-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && apk update \ 22 | && apk add \ 23 | acl \ 24 | ca-certificates \ 25 | curl \ 26 | git \ 27 | gnupg \ 28 | mercurial \ 29 | rsync \ 30 | shadow \ 31 | subversion \ 32 | sudo 33 | 34 | RUN set -x \ 35 | && touch /root/.profile \ 36 | # Install node packages 37 | && npm install --silent -g \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | # Configure root account 44 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 45 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 46 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 47 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 48 | && echo "export TERM=xterm" >> /root/.profile \ 49 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 50 | && echo "cd /src" >> /root/.profile \ 51 | # Create a dev user to use as the directory owner 52 | && addgroup dev \ 53 | && adduser -D -s /bin/sh -G dev dev \ 54 | && echo "dev:password" | chpasswd \ 55 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 56 | && rsync -a /root/ /home/dev/ \ 57 | && chown -R dev:dev /home/dev/ \ 58 | && chmod 0777 /home/dev \ 59 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 60 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 61 | # Setup wrapper scripts 62 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 63 | && chmod 0755 /run-as-user 64 | 65 | ############################################################################## 66 | # ~ fin ~ 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | && apk del \ 71 | curl \ 72 | gnupg \ 73 | linux-headers \ 74 | paxctl \ 75 | python \ 76 | rsync \ 77 | tar \ 78 | && rm -rf \ 79 | /var/cache/apk/* \ 80 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 81 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/html 83 | 84 | 85 | VOLUME /src 86 | WORKDIR /src 87 | 88 | ENTRYPOINT ["/run-as-user"] 89 | CMD ["/usr/local/bin/npm"] 90 | -------------------------------------------------------------------------------- /node-9-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:9-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && apk update \ 22 | && apk add \ 23 | acl \ 24 | ca-certificates \ 25 | curl \ 26 | git \ 27 | gnupg \ 28 | mercurial \ 29 | rsync \ 30 | shadow \ 31 | subversion \ 32 | sudo 33 | 34 | RUN set -x \ 35 | && touch /root/.profile \ 36 | # Install node packages 37 | && npm install --silent -g \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | # Configure root account 44 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 45 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 46 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 47 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 48 | && echo "export TERM=xterm" >> /root/.profile \ 49 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 50 | && echo "cd /src" >> /root/.profile \ 51 | # Create a dev user to use as the directory owner 52 | && addgroup dev \ 53 | && adduser -D -s /bin/sh -G dev dev \ 54 | && echo "dev:password" | chpasswd \ 55 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 56 | && rsync -a /root/ /home/dev/ \ 57 | && chown -R dev:dev /home/dev/ \ 58 | && chmod 0777 /home/dev \ 59 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 60 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 61 | # Setup wrapper scripts 62 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 63 | && chmod 0755 /run-as-user 64 | 65 | ############################################################################## 66 | # ~ fin ~ 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | && apk del \ 71 | curl \ 72 | gnupg \ 73 | linux-headers \ 74 | paxctl \ 75 | python \ 76 | rsync \ 77 | tar \ 78 | && rm -rf \ 79 | /var/cache/apk/* \ 80 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 81 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/html 83 | 84 | 85 | VOLUME /src 86 | WORKDIR /src 87 | 88 | ENTRYPOINT ["/run-as-user"] 89 | CMD ["/usr/local/bin/npm"] 90 | -------------------------------------------------------------------------------- /node-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && apk update \ 22 | && apk add \ 23 | acl \ 24 | ca-certificates \ 25 | curl \ 26 | git \ 27 | gnupg \ 28 | mercurial \ 29 | rsync \ 30 | shadow \ 31 | subversion \ 32 | sudo 33 | 34 | RUN set -x \ 35 | && touch /root/.profile \ 36 | # Install node packages 37 | && npm install --silent -g \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | # Configure root account 44 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 45 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 46 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 47 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 48 | && echo "export TERM=xterm" >> /root/.profile \ 49 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 50 | && echo "cd /src" >> /root/.profile \ 51 | # Create a dev user to use as the directory owner 52 | && addgroup dev \ 53 | && adduser -D -s /bin/sh -G dev dev \ 54 | && echo "dev:password" | chpasswd \ 55 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 56 | && rsync -a /root/ /home/dev/ \ 57 | && chown -R dev:dev /home/dev/ \ 58 | && chmod 0777 /home/dev \ 59 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 60 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 61 | # Setup wrapper scripts 62 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 63 | && chmod 0755 /run-as-user 64 | 65 | ############################################################################## 66 | # ~ fin ~ 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | && apk del \ 71 | curl \ 72 | gnupg \ 73 | linux-headers \ 74 | paxctl \ 75 | python \ 76 | rsync \ 77 | tar \ 78 | && rm -rf \ 79 | /var/cache/apk/* \ 80 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 81 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/html 83 | 84 | 85 | VOLUME /src 86 | WORKDIR /src 87 | 88 | ENTRYPOINT ["/run-as-user"] 89 | CMD ["/usr/local/bin/npm"] 90 | -------------------------------------------------------------------------------- /node-10-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && apk update \ 22 | && apk add \ 23 | acl \ 24 | ca-certificates \ 25 | curl \ 26 | git \ 27 | gnupg \ 28 | mercurial \ 29 | rsync \ 30 | shadow \ 31 | subversion \ 32 | sudo 33 | 34 | RUN set -x \ 35 | && touch /root/.profile \ 36 | # Install node packages 37 | && npm install --silent -g \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | # Configure root account 44 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 45 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 46 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 47 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 48 | && echo "export TERM=xterm" >> /root/.profile \ 49 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 50 | && echo "cd /src" >> /root/.profile \ 51 | # Create a dev user to use as the directory owner 52 | && addgroup dev \ 53 | && adduser -D -s /bin/sh -G dev dev \ 54 | && echo "dev:password" | chpasswd \ 55 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 56 | && rsync -a /root/ /home/dev/ \ 57 | && chown -R dev:dev /home/dev/ \ 58 | && chmod 0777 /home/dev \ 59 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 60 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 61 | # Setup wrapper scripts 62 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 63 | && chmod 0755 /run-as-user 64 | 65 | ############################################################################## 66 | # ~ fin ~ 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | && apk del \ 71 | curl \ 72 | gnupg \ 73 | linux-headers \ 74 | paxctl \ 75 | python \ 76 | rsync \ 77 | tar \ 78 | && rm -rf \ 79 | /var/cache/apk/* \ 80 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 81 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/html 83 | 84 | 85 | VOLUME /src 86 | WORKDIR /src 87 | 88 | ENTRYPOINT ["/run-as-user"] 89 | CMD ["/usr/local/bin/npm"] 90 | -------------------------------------------------------------------------------- /node-11-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:11-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && apk update \ 22 | && apk add \ 23 | acl \ 24 | ca-certificates \ 25 | curl \ 26 | git \ 27 | gnupg \ 28 | mercurial \ 29 | rsync \ 30 | shadow \ 31 | subversion \ 32 | sudo 33 | 34 | RUN set -x \ 35 | && touch /root/.profile \ 36 | # Install node packages 37 | && npm install --silent -g \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | # Configure root account 44 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 45 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 46 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 47 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 48 | && echo "export TERM=xterm" >> /root/.profile \ 49 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 50 | && echo "cd /src" >> /root/.profile \ 51 | # Create a dev user to use as the directory owner 52 | && addgroup dev \ 53 | && adduser -D -s /bin/sh -G dev dev \ 54 | && echo "dev:password" | chpasswd \ 55 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 56 | && rsync -a /root/ /home/dev/ \ 57 | && chown -R dev:dev /home/dev/ \ 58 | && chmod 0777 /home/dev \ 59 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 60 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 61 | # Setup wrapper scripts 62 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 63 | && chmod 0755 /run-as-user 64 | 65 | ############################################################################## 66 | # ~ fin ~ 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | && apk del \ 71 | curl \ 72 | gnupg \ 73 | linux-headers \ 74 | paxctl \ 75 | python \ 76 | rsync \ 77 | tar \ 78 | && rm -rf \ 79 | /var/cache/apk/* \ 80 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 81 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/html 83 | 84 | 85 | VOLUME /src 86 | WORKDIR /src 87 | 88 | ENTRYPOINT ["/run-as-user"] 89 | CMD ["/usr/local/bin/npm"] 90 | -------------------------------------------------------------------------------- /node-6-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:6-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ 22 | && echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ 23 | && apk update \ 24 | && apk add \ 25 | acl \ 26 | ca-certificates \ 27 | curl \ 28 | git \ 29 | gnupg \ 30 | mercurial \ 31 | rsync \ 32 | shadow \ 33 | subversion \ 34 | sudo 35 | 36 | RUN set -x \ 37 | && touch /root/.profile \ 38 | # Install node packages 39 | && npm install --silent -g \ 40 | gulp-cli \ 41 | grunt-cli \ 42 | bower \ 43 | markdown-styles \ 44 | npx \ 45 | # Configure root account 46 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 47 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 48 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 49 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 50 | && echo "export TERM=xterm" >> /root/.profile \ 51 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 52 | && echo "cd /src" >> /root/.profile \ 53 | # Create a dev user to use as the directory owner 54 | && addgroup dev \ 55 | && adduser -D -s /bin/sh -G dev dev \ 56 | && echo "dev:password" | chpasswd \ 57 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 58 | && rsync -a /root/ /home/dev/ \ 59 | && chown -R dev:dev /home/dev/ \ 60 | && chmod 0777 /home/dev \ 61 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 62 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 63 | # Setup wrapper scripts 64 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 65 | && chmod 0755 /run-as-user 66 | 67 | ############################################################################## 68 | # ~ fin ~ 69 | ############################################################################## 70 | 71 | RUN set -x \ 72 | && apk del \ 73 | curl \ 74 | gnupg \ 75 | linux-headers \ 76 | paxctl \ 77 | python \ 78 | rsync \ 79 | tar \ 80 | && rm -rf \ 81 | /var/cache/apk/* \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 83 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 84 | ${NODE_PREFIX}/lib/node_modules/npm/html 85 | 86 | 87 | VOLUME /src 88 | WORKDIR /src 89 | 90 | ENTRYPOINT ["/run-as-user"] 91 | CMD ["/usr/local/bin/npm"] 92 | -------------------------------------------------------------------------------- /node-7-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:7-alpine 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | ######################################################################## 18 | # Build tools 19 | ######################################################################## 20 | RUN set -x \ 21 | && echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ 22 | && echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ 23 | && apk update \ 24 | && apk add \ 25 | acl \ 26 | ca-certificates \ 27 | curl \ 28 | git \ 29 | gnupg \ 30 | mercurial \ 31 | rsync \ 32 | shadow \ 33 | subversion \ 34 | sudo 35 | 36 | RUN set -x \ 37 | && touch /root/.profile \ 38 | # Install node packages 39 | && npm install --silent -g \ 40 | gulp-cli \ 41 | grunt-cli \ 42 | bower \ 43 | markdown-styles \ 44 | npx \ 45 | # Configure root account 46 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \ 47 | && echo "export LANG=$(echo $LANG)" >> /root/.profile \ 48 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \ 49 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \ 50 | && echo "export TERM=xterm" >> /root/.profile \ 51 | && echo "export PATH=$(echo $PATH)" >> /root/.profile \ 52 | && echo "cd /src" >> /root/.profile \ 53 | # Create a dev user to use as the directory owner 54 | && addgroup dev \ 55 | && adduser -D -s /bin/sh -G dev dev \ 56 | && echo "dev:password" | chpasswd \ 57 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \ 58 | && rsync -a /root/ /home/dev/ \ 59 | && chown -R dev:dev /home/dev/ \ 60 | && chmod 0777 /home/dev \ 61 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 62 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \ 63 | # Setup wrapper scripts 64 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 65 | && chmod 0755 /run-as-user 66 | 67 | ############################################################################## 68 | # ~ fin ~ 69 | ############################################################################## 70 | 71 | RUN set -x \ 72 | && apk del \ 73 | curl \ 74 | gnupg \ 75 | linux-headers \ 76 | paxctl \ 77 | python \ 78 | rsync \ 79 | tar \ 80 | && rm -rf \ 81 | /var/cache/apk/* \ 82 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 83 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 84 | ${NODE_PREFIX}/lib/node_modules/npm/html 85 | 86 | 87 | VOLUME /src 88 | WORKDIR /src 89 | 90 | ENTRYPOINT ["/run-as-user"] 91 | CMD ["/usr/local/bin/npm"] 92 | -------------------------------------------------------------------------------- /test/1.build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $PROJECT_PATH/test/lib/list-changes.sh 4 | 5 | PREFIX=" " 6 | failed_tests= 7 | build_tag=ci-build 8 | 9 | for dockerfile in $(list_changes Dockerfile); do 10 | if [ -f $PROJECT_PATH/$dockerfile ]; then 11 | printf "\n\n\n -------- Building $dockerfile -------- \n\n\n" 12 | build_result=0 13 | 14 | echo " ...build" 15 | cd $PROJECT_PATH/$(dirname $dockerfile) 16 | docker build -t mkenney/npm:$build_tag . 17 | result=$? 18 | if [ 0 -ne $result ]; then 19 | echo "${PREFIX}$dockerfile build failed" 20 | exit 1 21 | fi 22 | cd $PROJECT_PATH/test 23 | 24 | echo " ...node" 25 | sh ./node.sh $build_tag 26 | result=$? 27 | echo $output 28 | if [ 0 -ne $result ]; then 29 | build_result=1 30 | failed_tests="$failed_tests node" 31 | fi; 32 | 33 | echo " ...bower" 34 | sh ./bower.sh $build_tag 35 | result=$? 36 | echo $output 37 | if [ 0 -ne $result ]; then 38 | build_result=1 39 | failed_tests="$failed_tests bower"; 40 | fi; 41 | 42 | echo " ...npm" 43 | sh ./npm.sh $build_tag 44 | result=$? 45 | echo $output 46 | if [ 0 -ne $result ]; then 47 | build_result=1 48 | failed_tests="$failed_tests npm"; 49 | fi; 50 | 51 | if \ 52 | [ "node-6.9-alpine/Dockerfile" != "$dockerfile" ] \ 53 | && [ "node-6.9-debian/Dockerfile" != "$dockerfile" ] \ 54 | && [ "node-7.0-debian/Dockerfile" != "$dockerfile" ] \ 55 | && [ "node-7.7-alpine/Dockerfile" != "$dockerfile" ] \ 56 | ; then 57 | echo " ...npx" 58 | sh ./npx.sh $build_tag 59 | result=$? 60 | echo $output 61 | if [ 0 -ne $result ]; then 62 | build_result=1 63 | failed_tests="$failed_tests npx" 64 | fi 65 | fi 66 | 67 | echo " ...yarn" 68 | sh ./yarn.sh $build_tag 69 | result=$? 70 | echo $output 71 | if [ 0 -ne $result ]; then 72 | build_result=1 73 | failed_tests="$failed_tests yarn" 74 | fi; 75 | 76 | echo " ...grunt" 77 | sh ./grunt.sh $build_tag 78 | result=$? 79 | echo $output 80 | if [ 0 -ne $result ]; then 81 | build_result=1 82 | failed_tests="$failed_tests grunt"; 83 | fi; 84 | 85 | echo " ...gulp" 86 | sh ./gulp.sh $build_tag 87 | result=$? 88 | echo $output 89 | if [ 0 -ne $result ]; then 90 | build_result=1 91 | failed_tests="$failed_tests gulp" 92 | fi; 93 | 94 | echo " ...markdown-styles" 95 | sh ./md.sh $build_tag 96 | result=$? 97 | echo $output 98 | if [ 0 -ne $result ]; then 99 | build_result=1 100 | failed_tests="$failed_tests md"; 101 | fi; 102 | 103 | if [ 0 -ne $build_result ]; then 104 | echo "${PREFIX}Build tests failed: $failed_tests" 105 | printf "\n\n\n -------- $dockerfile build tests failed -------- \n\n\n" 106 | exit $build_result; 107 | fi 108 | 109 | printf "\n\n\n -------- $dockerfile build tests succeeded -------- \n\n\n" 110 | 111 | fi 112 | done 113 | 114 | exit $build_result 115 | -------------------------------------------------------------------------------- /node-7-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:7-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && apt-get -qq update \ 23 | && apt-get install -qqy \ 24 | acl \ 25 | git \ 26 | mercurial \ 27 | rsync \ 28 | subversion \ 29 | sudo \ 30 | wget \ 31 | # Restore a borne-shell compatible default shell 32 | && rm /bin/sh \ 33 | && ln -s /bin/bash /bin/sh 34 | 35 | # install npm packages 36 | RUN set -x \ 37 | && npm install --silent --global \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 44 | 45 | ############################################################################## 46 | # UTF-8 Locale, timezone 47 | ############################################################################## 48 | 49 | RUN set -x \ 50 | && apt-get install -qqy locales \ 51 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 52 | && dpkg-reconfigure locales \ 53 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 54 | && export LANG=C.UTF-8 \ 55 | && export LANGUAGE=C.UTF-8 \ 56 | && export LC_ALL=C.UTF-8 \ 57 | && echo $TIMEZONE > /etc/timezone \ 58 | && dpkg-reconfigure -f noninteractive tzdata 59 | 60 | ############################################################################## 61 | # users 62 | ############################################################################## 63 | 64 | RUN set -x \ 65 | # Configure root account 66 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 67 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 68 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 69 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 70 | && echo "export TERM=xterm" >> /root/.bash_profile \ 71 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 72 | && echo "cd /src" >> /root/.bash_profile \ 73 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 74 | # Add a dev user and configure 75 | && groupadd dev \ 76 | && useradd dev -s /bin/bash -m -g dev \ 77 | && echo "dev:password" | chpasswd \ 78 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 79 | && rsync -a /root/ /home/dev/ \ 80 | && chown -R dev:dev /home/dev/ \ 81 | && chmod 0777 /home/dev \ 82 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 83 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 84 | 85 | ############################################################################## 86 | # ~ fin ~ 87 | ############################################################################## 88 | 89 | RUN set -x \ 90 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 91 | && chmod 0755 /run-as-user \ 92 | && apt-get clean \ 93 | && rm -rf /var/lib/apt/lists/* 94 | 95 | VOLUME /src 96 | WORKDIR /src 97 | 98 | ENTRYPOINT ["/run-as-user"] 99 | CMD ["/usr/local/bin/npm"] 100 | -------------------------------------------------------------------------------- /node-8-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:8-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && apt-get -qq update \ 23 | && apt-get install -qqy \ 24 | acl \ 25 | git \ 26 | mercurial \ 27 | rsync \ 28 | subversion \ 29 | sudo \ 30 | wget \ 31 | # Restore a borne-shell compatible default shell 32 | && rm /bin/sh \ 33 | && ln -s /bin/bash /bin/sh 34 | 35 | # install npm packages 36 | RUN set -x \ 37 | && npm install --silent --global \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | npx \ 43 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 44 | 45 | ############################################################################## 46 | # UTF-8 Locale, timezone 47 | ############################################################################## 48 | 49 | RUN set -x \ 50 | && apt-get install -qqy locales \ 51 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 52 | && dpkg-reconfigure locales \ 53 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 54 | && export LANG=C.UTF-8 \ 55 | && export LANGUAGE=C.UTF-8 \ 56 | && export LC_ALL=C.UTF-8 \ 57 | && echo $TIMEZONE > /etc/timezone \ 58 | && dpkg-reconfigure -f noninteractive tzdata 59 | 60 | ############################################################################## 61 | # users 62 | ############################################################################## 63 | 64 | RUN set -x \ 65 | # Configure root account 66 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 67 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 68 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 69 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 70 | && echo "export TERM=xterm" >> /root/.bash_profile \ 71 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 72 | && echo "cd /src" >> /root/.bash_profile \ 73 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 74 | # Add a dev user and configure 75 | && groupadd dev \ 76 | && useradd dev -s /bin/bash -m -g dev \ 77 | && echo "dev:password" | chpasswd \ 78 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 79 | && rsync -a /root/ /home/dev/ \ 80 | && chown -R dev:dev /home/dev/ \ 81 | && chmod 0777 /home/dev \ 82 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 83 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 84 | 85 | ############################################################################## 86 | # ~ fin ~ 87 | ############################################################################## 88 | 89 | RUN set -x \ 90 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 91 | && chmod 0755 /run-as-user \ 92 | && apt-get clean \ 93 | && rm -rf /var/lib/apt/lists/* 94 | 95 | VOLUME /src 96 | WORKDIR /src 97 | 98 | ENTRYPOINT ["/run-as-user"] 99 | CMD ["/usr/local/bin/npm"] 100 | -------------------------------------------------------------------------------- /node-6.9-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:6.9-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && apt-get -qq update \ 23 | && apt-get install -qqy \ 24 | acl \ 25 | git \ 26 | mercurial \ 27 | rsync \ 28 | subversion \ 29 | sudo \ 30 | wget \ 31 | # Restore a borne-shell compatible default shell 32 | && rm /bin/sh \ 33 | && ln -s /bin/bash /bin/sh 34 | 35 | # install npm packages 36 | RUN set -x \ 37 | && npm install --silent --global \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | yarn \ 43 | && npm install --silent --global \ 44 | gulp-cli \ 45 | grunt-cli \ 46 | bower \ 47 | markdown-styles \ 48 | yarn 49 | 50 | ############################################################################## 51 | # UTF-8 Locale, timezone 52 | ############################################################################## 53 | 54 | RUN set -x \ 55 | && apt-get install -qqy locales \ 56 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 57 | && dpkg-reconfigure locales \ 58 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 59 | && export LANG=C.UTF-8 \ 60 | && export LANGUAGE=C.UTF-8 \ 61 | && export LC_ALL=C.UTF-8 \ 62 | && echo $TIMEZONE > /etc/timezone \ 63 | && dpkg-reconfigure -f noninteractive tzdata 64 | 65 | ############################################################################## 66 | # users 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | # Configure root account 71 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 72 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 73 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 74 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 75 | && echo "export TERM=xterm" >> /root/.bash_profile \ 76 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 77 | && echo "cd /src" >> /root/.bash_profile \ 78 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 79 | # Add a dev user and configure 80 | && groupadd dev \ 81 | && useradd dev -s /bin/bash -m -g dev \ 82 | && echo "dev:password" | chpasswd \ 83 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 84 | && rsync -a /root/ /home/dev/ \ 85 | && chown -R dev:dev /home/dev/ \ 86 | && chmod 0777 /home/dev \ 87 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 88 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 89 | 90 | ############################################################################## 91 | # ~ fin ~ 92 | ############################################################################## 93 | 94 | RUN set -x \ 95 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 96 | && chmod 0755 /run-as-user \ 97 | && apt-get clean \ 98 | && rm -rf /var/lib/apt/lists/* 99 | 100 | VOLUME /src 101 | WORKDIR /src 102 | 103 | ENTRYPOINT ["/run-as-user"] 104 | CMD ["/usr/local/bin/npm"] 105 | -------------------------------------------------------------------------------- /node-7.0-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:7.0-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && apt-get -qq update \ 23 | && apt-get install -qqy \ 24 | acl \ 25 | git \ 26 | mercurial \ 27 | rsync \ 28 | subversion \ 29 | sudo \ 30 | wget \ 31 | # Restore a borne-shell compatible default shell 32 | && rm /bin/sh \ 33 | && ln -s /bin/bash /bin/sh 34 | 35 | # install npm packages 36 | RUN set -x \ 37 | && npm install --silent --global \ 38 | gulp-cli \ 39 | grunt-cli \ 40 | bower \ 41 | markdown-styles \ 42 | yarn \ 43 | && npm install --silent --global \ 44 | gulp-cli \ 45 | grunt-cli \ 46 | bower \ 47 | markdown-styles \ 48 | yarn 49 | 50 | ############################################################################## 51 | # UTF-8 Locale, timezone 52 | ############################################################################## 53 | 54 | RUN set -x \ 55 | && apt-get install -qqy locales \ 56 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 57 | && dpkg-reconfigure locales \ 58 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 59 | && export LANG=C.UTF-8 \ 60 | && export LANGUAGE=C.UTF-8 \ 61 | && export LC_ALL=C.UTF-8 \ 62 | && echo $TIMEZONE > /etc/timezone \ 63 | && dpkg-reconfigure -f noninteractive tzdata 64 | 65 | ############################################################################## 66 | # users 67 | ############################################################################## 68 | 69 | RUN set -x \ 70 | # Configure root account 71 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 72 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 73 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 74 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 75 | && echo "export TERM=xterm" >> /root/.bash_profile \ 76 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 77 | && echo "cd /src" >> /root/.bash_profile \ 78 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 79 | # Add a dev user and configure 80 | && groupadd dev \ 81 | && useradd dev -s /bin/bash -m -g dev \ 82 | && echo "dev:password" | chpasswd \ 83 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 84 | && rsync -a /root/ /home/dev/ \ 85 | && chown -R dev:dev /home/dev/ \ 86 | && chmod 0777 /home/dev \ 87 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 88 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 89 | 90 | ############################################################################## 91 | # ~ fin ~ 92 | ############################################################################## 93 | 94 | RUN set -x \ 95 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 96 | && chmod 0755 /run-as-user \ 97 | && apt-get clean \ 98 | && rm -rf /var/lib/apt/lists/* 99 | 100 | VOLUME /src 101 | WORKDIR /src 102 | 103 | ENTRYPOINT ["/run-as-user"] 104 | CMD ["/usr/local/bin/npm"] 105 | -------------------------------------------------------------------------------- /node-9-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:9-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 23 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 24 | && apt-get -qq update \ 25 | && apt-get install -qqy \ 26 | acl \ 27 | git \ 28 | mercurial \ 29 | rsync \ 30 | subversion \ 31 | sudo \ 32 | wget \ 33 | # Restore a borne-shell compatible default shell 34 | && rm /bin/sh \ 35 | && ln -s /bin/bash /bin/sh 36 | 37 | 38 | # install npm packages 39 | RUN set -x \ 40 | && npm install --silent --global \ 41 | gulp-cli \ 42 | grunt-cli \ 43 | bower \ 44 | markdown-styles \ 45 | npx \ 46 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 47 | 48 | ############################################################################## 49 | # UTF-8 Locale, timezone 50 | ############################################################################## 51 | 52 | RUN set -x \ 53 | && apt-get install -qqy locales \ 54 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 55 | && dpkg-reconfigure locales \ 56 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 57 | && export LANG=C.UTF-8 \ 58 | && export LANGUAGE=C.UTF-8 \ 59 | && export LC_ALL=C.UTF-8 \ 60 | && echo $TIMEZONE > /etc/timezone \ 61 | && dpkg-reconfigure -f noninteractive tzdata 62 | 63 | ############################################################################## 64 | # users 65 | ############################################################################## 66 | 67 | RUN set -x \ 68 | # Configure root account 69 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 70 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 71 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 72 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 73 | && echo "export TERM=xterm" >> /root/.bash_profile \ 74 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 75 | && echo "cd /src" >> /root/.bash_profile \ 76 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 77 | # Add a dev user and configure 78 | && groupadd dev \ 79 | && useradd dev -s /bin/bash -m -g dev \ 80 | && echo "dev:password" | chpasswd \ 81 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 82 | && rsync -a /root/ /home/dev/ \ 83 | && chown -R dev:dev /home/dev/ \ 84 | && chmod 0777 /home/dev \ 85 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 86 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 87 | 88 | ############################################################################## 89 | # ~ fin ~ 90 | ############################################################################## 91 | 92 | RUN set -x \ 93 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 94 | && chmod 0755 /run-as-user \ 95 | && apt-get clean \ 96 | && rm -rf /var/lib/apt/lists/* 97 | 98 | VOLUME /src 99 | WORKDIR /src 100 | 101 | ENTRYPOINT ["/run-as-user"] 102 | CMD ["/usr/local/bin/npm"] 103 | -------------------------------------------------------------------------------- /node-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 23 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 24 | && apt-get -qq update \ 25 | && apt-get install -qqy \ 26 | acl \ 27 | git \ 28 | mercurial \ 29 | rsync \ 30 | subversion \ 31 | sudo \ 32 | wget \ 33 | # Restore a borne-shell compatible default shell 34 | && rm /bin/sh \ 35 | && ln -s /bin/bash /bin/sh 36 | 37 | 38 | # install npm packages 39 | RUN set -x \ 40 | && npm install --silent --global \ 41 | gulp-cli \ 42 | grunt-cli \ 43 | bower \ 44 | markdown-styles \ 45 | npx \ 46 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 47 | 48 | ############################################################################## 49 | # UTF-8 Locale, timezone 50 | ############################################################################## 51 | 52 | RUN set -x \ 53 | && apt-get install -qqy locales \ 54 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 55 | && dpkg-reconfigure locales \ 56 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 57 | && export LANG=C.UTF-8 \ 58 | && export LANGUAGE=C.UTF-8 \ 59 | && export LC_ALL=C.UTF-8 \ 60 | && echo $TIMEZONE > /etc/timezone \ 61 | && dpkg-reconfigure -f noninteractive tzdata 62 | 63 | ############################################################################## 64 | # users 65 | ############################################################################## 66 | 67 | RUN set -x \ 68 | # Configure root account 69 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 70 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 71 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 72 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 73 | && echo "export TERM=xterm" >> /root/.bash_profile \ 74 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 75 | && echo "cd /src" >> /root/.bash_profile \ 76 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 77 | # Add a dev user and configure 78 | && groupadd dev \ 79 | && useradd dev -s /bin/bash -m -g dev \ 80 | && echo "dev:password" | chpasswd \ 81 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 82 | && rsync -a /root/ /home/dev/ \ 83 | && chown -R dev:dev /home/dev/ \ 84 | && chmod 0777 /home/dev \ 85 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 86 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 87 | 88 | ############################################################################## 89 | # ~ fin ~ 90 | ############################################################################## 91 | 92 | RUN set -x \ 93 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 94 | && chmod 0755 /run-as-user \ 95 | && apt-get clean \ 96 | && rm -rf /var/lib/apt/lists/* 97 | 98 | VOLUME /src 99 | WORKDIR /src 100 | 101 | ENTRYPOINT ["/run-as-user"] 102 | CMD ["/usr/local/bin/npm"] 103 | -------------------------------------------------------------------------------- /node-10-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10-wheezy 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 23 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 24 | && apt-get -qq update \ 25 | && apt-get install -qqy \ 26 | acl \ 27 | git \ 28 | mercurial \ 29 | rsync \ 30 | subversion \ 31 | sudo \ 32 | wget \ 33 | # Restore a borne-shell compatible default shell 34 | && rm /bin/sh \ 35 | && ln -s /bin/bash /bin/sh 36 | 37 | 38 | # install npm packages 39 | RUN set -x \ 40 | && npm install --silent --global \ 41 | gulp-cli \ 42 | grunt-cli \ 43 | bower \ 44 | markdown-styles \ 45 | npx \ 46 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 47 | 48 | ############################################################################## 49 | # UTF-8 Locale, timezone 50 | ############################################################################## 51 | 52 | RUN set -x \ 53 | && apt-get install -qqy locales \ 54 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 55 | && dpkg-reconfigure locales \ 56 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 57 | && export LANG=C.UTF-8 \ 58 | && export LANGUAGE=C.UTF-8 \ 59 | && export LC_ALL=C.UTF-8 \ 60 | && echo $TIMEZONE > /etc/timezone \ 61 | && dpkg-reconfigure -f noninteractive tzdata 62 | 63 | ############################################################################## 64 | # users 65 | ############################################################################## 66 | 67 | RUN set -x \ 68 | # Configure root account 69 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 70 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 71 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 72 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 73 | && echo "export TERM=xterm" >> /root/.bash_profile \ 74 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 75 | && echo "cd /src" >> /root/.bash_profile \ 76 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 77 | # Add a dev user and configure 78 | && groupadd dev \ 79 | && useradd dev -s /bin/bash -m -g dev \ 80 | && echo "dev:password" | chpasswd \ 81 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 82 | && rsync -a /root/ /home/dev/ \ 83 | && chown -R dev:dev /home/dev/ \ 84 | && chmod 0777 /home/dev \ 85 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 86 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 87 | 88 | ############################################################################## 89 | # ~ fin ~ 90 | ############################################################################## 91 | 92 | RUN set -x \ 93 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 94 | && chmod 0755 /run-as-user \ 95 | && apt-get clean \ 96 | && rm -rf /var/lib/apt/lists/* 97 | 98 | VOLUME /src 99 | WORKDIR /src 100 | 101 | ENTRYPOINT ["/run-as-user"] 102 | CMD ["/usr/local/bin/npm"] 103 | -------------------------------------------------------------------------------- /node-11-debian/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:11-stretch 2 | 3 | LABEL org.label-schema.schema-version = 1.0.0 \ 4 | org.label-schema.vendor = mkenney@webbedlam.com \ 5 | org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \ 6 | org.label-schema.description = "This image provides node based build tools." \ 7 | org.label-schema.name = "NPM" \ 8 | org.label-schema.url = http://mkenney.github.io/docker-npm/ 9 | 10 | ENV TERM=xterm \ 11 | NLS_LANG=American_America.AL32UTF8 \ 12 | LANG=C.UTF-8 \ 13 | LANGUAGE=C.UTF-8 \ 14 | LC_ALL=C.UTF-8 \ 15 | TIMEZONE=America/Denver 16 | 17 | RUN set -x \ 18 | && apt-get -qq update \ 19 | && apt-get install -qqy apt-transport-https apt-utils \ 20 | && apt-get -qq upgrade \ 21 | && apt-get -qq dist-upgrade \ 22 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 23 | && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 24 | && apt-get -qq update \ 25 | && apt-get install -qqy \ 26 | acl \ 27 | git \ 28 | mercurial \ 29 | rsync \ 30 | subversion \ 31 | sudo \ 32 | wget \ 33 | # Restore a borne-shell compatible default shell 34 | && rm /bin/sh \ 35 | && ln -s /bin/bash /bin/sh 36 | 37 | 38 | # install npm packages 39 | RUN set -x \ 40 | && npm install --silent --global \ 41 | gulp-cli \ 42 | grunt-cli \ 43 | bower \ 44 | markdown-styles \ 45 | npx \ 46 | && curl --compressed -o- -L https://yarnpkg.com/install.sh | sh 47 | 48 | ############################################################################## 49 | # UTF-8 Locale, timezone 50 | ############################################################################## 51 | 52 | RUN set -x \ 53 | && apt-get install -qqy locales \ 54 | && locale-gen C.UTF-8 ${UTF8_LOCALE} \ 55 | && dpkg-reconfigure locales \ 56 | && /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \ 57 | && export LANG=C.UTF-8 \ 58 | && export LANGUAGE=C.UTF-8 \ 59 | && export LC_ALL=C.UTF-8 \ 60 | && echo $TIMEZONE > /etc/timezone \ 61 | && dpkg-reconfigure -f noninteractive tzdata 62 | 63 | ############################################################################## 64 | # users 65 | ############################################################################## 66 | 67 | RUN set -x \ 68 | # Configure root account 69 | && echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \ 70 | && echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \ 71 | && echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \ 72 | && echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \ 73 | && echo "export TERM=xterm" >> /root/.bash_profile \ 74 | && echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \ 75 | && echo "cd /src" >> /root/.bash_profile \ 76 | && echo "source \$HOME/.bashrc" >> /root/.bash_profile \ 77 | # Add a dev user and configure 78 | && groupadd dev \ 79 | && useradd dev -s /bin/bash -m -g dev \ 80 | && echo "dev:password" | chpasswd \ 81 | && echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \ 82 | && rsync -a /root/ /home/dev/ \ 83 | && chown -R dev:dev /home/dev/ \ 84 | && chmod 0777 /home/dev \ 85 | && chmod -R u+rwX,g+rwX,o+rwX /home/dev \ 86 | && setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev 87 | 88 | ############################################################################## 89 | # ~ fin ~ 90 | ############################################################################## 91 | 92 | RUN set -x \ 93 | && wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 94 | && chmod 0755 /run-as-user \ 95 | && apt-get clean \ 96 | && rm -rf /var/lib/apt/lists/* 97 | 98 | VOLUME /src 99 | WORKDIR /src 100 | 101 | ENTRYPOINT ["/run-as-user"] 102 | CMD ["/usr/local/bin/npm"] 103 | -------------------------------------------------------------------------------- /bin/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | INSTALL_SCRIPT_URL=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh 4 | INSTALL_SCRIPT=/tmp/docker-npm-install 5 | SELF=$0 6 | COMMAND=$1 7 | PREFIX=$2 8 | 9 | # 10 | # Loosely based on https://npmjs.org/install.sh, run as `curl | sh` 11 | # http://www.gnu.org/s/hello/manual/autoconf/Portable-Shell.html 12 | # Download the master install script and execute it locally 13 | # 14 | if [ "sh" == "$SELF" ] || [ "bash" == "$SELF" ]; then 15 | 16 | # 17 | # Download and execute the install script 18 | # 19 | curl -f -L -s $INSTALL_SCRIPT_URL > $INSTALL_SCRIPT.sh 20 | exit_code=$? 21 | if [ $exit_code -eq 0 ]; then 22 | if head $INSTALL_SCRIPT.sh | grep -q '404: Not Found'; then 23 | echo "Install failed: The installation script could not be found at $INSTALL_SCRIPT_URL" >&2 24 | rm -f $INSTALL_SCRIPT.sh 25 | exit 404 26 | fi 27 | if ! [ -s $INSTALL_SCRIPT.sh ]; then 28 | echo 29 | echo "Install failed: Invalid or empty script at $INSTALL_SCRIPT_URL" >&2 30 | exit 1 31 | fi 32 | (exit 0) 33 | else 34 | echo 35 | echo "Install failed: Could not download 'install.sh' from $INSTALL_SCRIPT_URL" >&2 36 | exit $exit_code 37 | fi 38 | 39 | bash $INSTALL_SCRIPT.sh $@ 40 | exit_code=$? 41 | rm -f $INSTALL_SCRIPT.sh 42 | exit $exit_code 43 | fi 44 | 45 | # 46 | # Usage 47 | # 48 | function usage() { 49 | if [ "sh" == "$SELF" ] || [ "bash" == "$SELF" ]; then 50 | SELF="bash -s" 51 | fi 52 | 53 | echo " 54 | Usage 55 | $SELF COMMAND [PREFIX] 56 | 57 | Synopsys 58 | Install a mkenney/npm container execution script locally 59 | 60 | Options 61 | COMMAND - Required, the name of the command to install (bower, gulp, npm, etc.) 62 | PREFIX - Optional, the location to install the command script. Default '\$HOME/bin' 63 | 64 | Examples 65 | $ curl -L $INSTALL_SCRIPT_URL | bash -s gulp 7.0-alpine \$HOME/bin 66 | $ bash ./install.sh gulp 7.0-alpine \$HOME/bin" 67 | } 68 | 69 | # 70 | # COMMAND is a required argument 71 | # 72 | if [ "" == "$COMMAND" ] || [ "install.sh" == "$COMMAND" ]; then 73 | usage 74 | exit 1 75 | fi 76 | 77 | # 78 | # Set defaults 79 | # 80 | if [ "" == "$PREFIX" ]; then 81 | PREFIX=$HOME/bin 82 | fi 83 | 84 | COMMAND_URL=https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/$COMMAND 85 | COMMAND_TEMPFILE=/tmp/docker-npm-$COMMAND-wrapper 86 | 87 | # 88 | # Download and validate the script 89 | # 90 | curl -f -L -s $COMMAND_URL > $COMMAND_TEMPFILE 91 | exit_code=$? 92 | if [ $exit_code -ne 0 ]; then 93 | echo 94 | echo "Install failed: Could not download '$COMMAND' from $COMMAND_URL" 95 | exit $exit_code 96 | fi 97 | if grep -q '404: Not Found' $COMMAND_TEMPFILE; then 98 | usage 99 | echo 100 | echo "Not found: The $COMMAND script was not found at $COMMAND_URL"; 101 | echo "Please verify that the COMMAND values are correct" 102 | exit 404 103 | fi 104 | if ! [ -s $COMMAND_TEMPFILE ]; then 105 | echo 106 | echo "Install failed: Invalid or empty '$COMMAND' script or download failed at $COMMAND_URL" 107 | exit $exit_code 108 | fi 109 | 110 | # 111 | # Create the installation directory 112 | # 113 | mkdir -p $PREFIX 114 | exit_code=$? 115 | if [ 0 -ne $exit_code ]; then 116 | echo 117 | echo "Install failed: Could not create directory '$PREFIX'" 118 | exit $exit_code 119 | fi 120 | 121 | # 122 | # Cat the tempfile into the command file instead of moving it so that 123 | # symlinkys aren't destroyed 124 | # 125 | cat $COMMAND_TEMPFILE > $PREFIX/$COMMAND && chmod +x $PREFIX/$COMMAND 126 | exit_code=$? 127 | if [ 0 -ne $exit_code ]; then 128 | echo 129 | echo "Install failed: Could not update '$PREFIX/$COMMAND'" 130 | exit $exit_code 131 | fi 132 | 133 | # 134 | # Cleanup the tempfile 135 | # 136 | rm -f $COMMAND_TEMPFILE 137 | exit_code=$? 138 | if [ 0 -ne $exit_code ]; then 139 | echo 140 | echo "Error: Could not delete tempfile '$COMMAND_TEMPFILE'" 141 | exit $exit_code 142 | fi 143 | 144 | echo 145 | echo "$PREFIX/$COMMAND: Installation succeeded" 146 | exit 0 147 | -------------------------------------------------------------------------------- /node-6.9-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | LABEL version="1.0.0" \ 4 | node="v6.9" \ 5 | os="Alpine v3.4" \ 6 | description="Node v6.9 compiled from source running on Alpine v3.4" 7 | 8 | ENV TERM=xterm \ 9 | NLS_LANG=American_America.AL32UTF8 \ 10 | LANG=C.UTF-8 \ 11 | LANGUAGE=C.UTF-8 \ 12 | LC_ALL=C.UTF-8 \ 13 | TIMEZONE=America/Denver 14 | 15 | ENV NODE_VERSION=v6.9.5 \ 16 | NODE_PREFIX=/usr/local 17 | 18 | RUN set -x \ 19 | && echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ 20 | && echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ 21 | && apk update \ 22 | && apk add \ 23 | ca-certificates \ 24 | curl \ 25 | g++ \ 26 | gcc \ 27 | git \ 28 | gnupg \ 29 | libgcc \ 30 | libstdc++ \ 31 | linux-headers \ 32 | make \ 33 | mercurial \ 34 | openssh \ 35 | paxctl \ 36 | python \ 37 | shadow \ 38 | subversion \ 39 | sudo \ 40 | tar 41 | 42 | ############################################################################## 43 | # Install Node & NPM 44 | # Based on https://github.com/mhart/alpine-node/blob/master/Dockerfile (thank you) 45 | ############################################################################## 46 | 47 | RUN set -x \ 48 | # Download and validate the NodeJs source 49 | && for key in \ 50 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ 51 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ 52 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ 53 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ 54 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 55 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ 56 | 56730D5401028683275BD23C23EFEFE93C4CFFFE \ 57 | ; do \ 58 | gpg --keyserver pgp.mit.edu --recv-keys "$key"|| \ 59 | gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ 60 | gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ 61 | done \ 62 | && mkdir /node_src \ 63 | && cd /node_src \ 64 | && curl -o node-${NODE_VERSION}.tar.gz -sSL https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.gz \ 65 | && curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc \ 66 | && gpg --verify SHASUMS256.txt.asc \ 67 | && grep node-${NODE_VERSION}.tar.gz SHASUMS256.txt.asc | sha256sum -c - 68 | 69 | RUN set -x \ 70 | # Compile and install 71 | && cd /node_src \ 72 | && tar -zxf node-${NODE_VERSION}.tar.gz \ 73 | && cd node-${NODE_VERSION} \ 74 | && export GYP_DEFINES="linux_use_gold_flags=0" \ 75 | && ./configure --prefix=${NODE_PREFIX} \ 76 | && NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \ 77 | && make -j${NPROC} -C out mksnapshot BUILDTYPE=Release \ 78 | && paxctl -cm out/Release/mksnapshot \ 79 | && make -j${NPROC} \ 80 | && make install \ 81 | && paxctl -cm ${NODE_PREFIX}/bin/node 82 | 83 | RUN set -x \ 84 | # Install node packages 85 | && npm install --silent -g \ 86 | gulp-cli \ 87 | grunt-cli \ 88 | bower \ 89 | markdown-styles \ 90 | yarn 91 | 92 | ############################################################################## 93 | # users 94 | ############################################################################## 95 | 96 | RUN set -x \ 97 | # Create a dev user to use as the directory owner 98 | && addgroup dev \ 99 | && adduser -D -s /bin/sh -G dev dev \ 100 | && echo "dev:password" | chpasswd \ 101 | 102 | # Setup wrapper scripts 103 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 104 | && chmod 0755 /run-as-user 105 | 106 | ############################################################################## 107 | # ~ fin ~ 108 | ############################################################################## 109 | 110 | RUN set -x \ 111 | && apk del \ 112 | curl \ 113 | gnupg \ 114 | linux-headers \ 115 | paxctl \ 116 | python \ 117 | tar \ 118 | 119 | && find ${NODE_PREFIX}/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf \ 120 | 121 | && rm -rf \ 122 | /node_src \ 123 | /tmp/* \ 124 | /var/cache/apk/* \ 125 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 126 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 127 | ${NODE_PREFIX}/lib/node_modules/npm/html 128 | 129 | 130 | VOLUME /src 131 | WORKDIR /src 132 | 133 | ENTRYPOINT ["/run-as-user"] 134 | CMD ["/usr/local/bin/npm"] 135 | -------------------------------------------------------------------------------- /node-7.7-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | LABEL version="1.0.0" \ 4 | node="v7.7" \ 5 | os="Alpine v3.4" \ 6 | description="Node v7.7 compiled from source running on Alpine v3.4" 7 | 8 | ENV TERM=xterm \ 9 | NLS_LANG=American_America.AL32UTF8 \ 10 | LANG=C.UTF-8 \ 11 | LANGUAGE=C.UTF-8 \ 12 | LC_ALL=C.UTF-8 \ 13 | TIMEZONE=America/Denver 14 | 15 | ENV NODE_VERSION=v7.7.4 \ 16 | NODE_PREFIX=/usr/local 17 | 18 | RUN set -x \ 19 | && echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ 20 | && echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ 21 | && apk update \ 22 | && apk add \ 23 | ca-certificates \ 24 | curl \ 25 | g++ \ 26 | gcc \ 27 | git \ 28 | gnupg \ 29 | libgcc \ 30 | libstdc++ \ 31 | linux-headers \ 32 | make \ 33 | mercurial \ 34 | openssh \ 35 | paxctl \ 36 | python \ 37 | shadow \ 38 | subversion \ 39 | sudo \ 40 | tar 41 | 42 | ############################################################################## 43 | # Install Node & NPM 44 | # Based on https://github.com/mhart/alpine-node/blob/master/Dockerfile (thank you) 45 | ############################################################################## 46 | 47 | RUN set -x \ 48 | # Download and validate the NodeJs source 49 | && for key in \ 50 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ 51 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ 52 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ 53 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ 54 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 55 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ 56 | 56730D5401028683275BD23C23EFEFE93C4CFFFE \ 57 | ; do \ 58 | gpg --keyserver pgp.mit.edu --recv-keys "$key"|| \ 59 | gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ 60 | gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ 61 | done \ 62 | && mkdir /node_src \ 63 | && cd /node_src \ 64 | && curl -o node-${NODE_VERSION}.tar.gz -sSL https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.gz \ 65 | && curl -o SHASUMS256.txt.asc -sSL https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc \ 66 | && gpg --verify SHASUMS256.txt.asc \ 67 | && grep node-${NODE_VERSION}.tar.gz SHASUMS256.txt.asc | sha256sum -c - 68 | 69 | RUN set -x \ 70 | # Compile and install 71 | && cd /node_src \ 72 | && tar -zxf node-${NODE_VERSION}.tar.gz \ 73 | && cd node-${NODE_VERSION} \ 74 | && export GYP_DEFINES="linux_use_gold_flags=0" \ 75 | && ./configure --prefix=${NODE_PREFIX} \ 76 | && NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \ 77 | && make -j${NPROC} -C out mksnapshot BUILDTYPE=Release \ 78 | && paxctl -cm out/Release/mksnapshot \ 79 | && make -j${NPROC} \ 80 | && make install \ 81 | && paxctl -cm ${NODE_PREFIX}/bin/node 82 | 83 | RUN set -x \ 84 | # Install node packages 85 | && npm install --silent -g \ 86 | gulp-cli \ 87 | grunt-cli \ 88 | bower \ 89 | markdown-styles \ 90 | yarn 91 | 92 | ############################################################################## 93 | # users 94 | ############################################################################## 95 | 96 | RUN set -x \ 97 | # Create a dev user to use as the directory owner 98 | && addgroup dev \ 99 | && adduser -D -s /bin/sh -G dev dev \ 100 | && echo "dev:password" | chpasswd \ 101 | 102 | # Setup wrapper scripts 103 | && curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \ 104 | && chmod 0755 /run-as-user 105 | 106 | ############################################################################## 107 | # ~ fin ~ 108 | ############################################################################## 109 | 110 | RUN set -x \ 111 | && apk del \ 112 | curl \ 113 | gnupg \ 114 | linux-headers \ 115 | paxctl \ 116 | python \ 117 | tar \ 118 | 119 | && find ${NODE_PREFIX}/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf \ 120 | 121 | && rm -rf \ 122 | /node_src \ 123 | /tmp/* \ 124 | /var/cache/apk/* \ 125 | ${NODE_PREFIX}/lib/node_modules/npm/man \ 126 | ${NODE_PREFIX}/lib/node_modules/npm/doc \ 127 | ${NODE_PREFIX}/lib/node_modules/npm/html 128 | 129 | 130 | VOLUME /src 131 | WORKDIR /src 132 | 133 | ENTRYPOINT ["/run-as-user"] 134 | CMD ["/usr/local/bin/npm"] 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![docker-badges.webbedlam.com](http://docker-badges.webbedlam.com/image/mkenney/npm)](https://hub.docker.com/r/mkenney/npm/) 2 | 3 | # npm and related build and dev tools 4 | 5 | [![MIT License](https://img.shields.io/github/license/mkenney/k8s-proxy.svg)](https://github.com/mkenney/docker-npm/blob/master/LICENSE) [![stability-mature](https://img.shields.io/badge/stability-mature-008000.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#mature) [![Build status](https://travis-ci.org/mkenney/docker-npm.svg?branch=master)](https://travis-ci.org/mkenney/docker-npm) [![Github issues](https://img.shields.io/github/issues-raw/mkenney/docker-npm.svg)](https://github.com/mkenney/docker-npm/issues) [![Github pull requests](https://img.shields.io/github/issues-pr/mkenney/docker-npm.svg)](https://github.com/mkenney/docker-npm/pulls) 6 | 7 | Please feel free to [create an issue](https://github.com/mkenney/docker-npm/issues) or [open a pull request](https://github.com/mkenney/docker-npm/pull/new/master) if you need support or would like to contribute. 8 | 9 | ## Portable `node`, package managers and build tools 10 | 11 | - [Tagged Images](#tagged-images) 12 | - [About](#about) 13 | - [Images](#images) 14 | - [Installation](#installation) 15 | - [Change log](#change-log) 16 | 17 | ## Announcements 18 | 19 | ### v1.1.0 released 20 | 21 | 2019-02-25 22 | 23 | * Added `node` v11 images and tests 24 | * Updated the shell scripts to default to `node-11-alpine` image (you can always use the `DOCKER_NPM_TAG` variable to use another image). 25 | 26 | ## Tagged Images 27 | 28 | Images are tagged according to the installed Node version and operating system. Package versions are not pinned, instead [`npm`](https://npmjs.org/) is executed to install current versions of each package. If stability issues aries, I will pin package versions in a `Dockerfile` for that Node/OS version and create a image tagged as `stable` based on it. Please [let me know](https://github.com/mkenney/docker-npm/issues) if you run into this situation. 29 | 30 | ### Alpine 31 | 32 | #### [`alpine`, `latest` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/alpine/Dockerfile) 33 | 34 | Based on [`node:alpine`](https://hub.docker.com/_/node/). This image should be considered under development and may not be as stable as versioned images. 35 | 36 | #### [`node-11-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-11-alpine/Dockerfile) 37 | 38 | Based on [`node:11-alpine`](https://hub.docker.com/r/library/node/tags/11-alpine/). 39 | 40 | #### [`node-10-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-10-alpine/Dockerfile) 41 | 42 | Based on [`node:10-alpine`](https://hub.docker.com/r/library/node/tags/10-alpine/). 43 | 44 | #### [`node-9-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-9-alpine/Dockerfile) 45 | 46 | Based on [`node:9-alpine`](https://hub.docker.com/r/library/node/tags/9-alpine/). 47 | 48 | #### [`node-8-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-8-alpine/Dockerfile) 49 | 50 | Based on [`node:8-alpine`](https://hub.docker.com/r/library/node/tags/8-alpine/). 51 | 52 | #### [`node-7-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-7-alpine/Dockerfile) 53 | 54 | Based on [`node:7-alpine`](https://hub.docker.com/r/library/node/tags/7-alpine/). 55 | 56 | #### [`node-6-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-6-alpine/Dockerfile) 57 | 58 | Based on [`node:6-alpine`](https://hub.docker.com/r/library/node/tags/6-alpine/). 59 | 60 | ### Debian 61 | 62 | #### [`debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/debian/Dockerfile) 63 | 64 | Based on [`node:latest`](https://hub.docker.com/r/library/node/tags/latest/). This image should be considered under development and may not be as stable as versioned images. 65 | 66 | #### [`node-11-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-11-debian/Dockerfile) 67 | 68 | Based on [`node:11-stretch`](https://hub.docker.com/r/library/node/tags/11-stretch/). 69 | 70 | #### [`node-10-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-10-debian/Dockerfile) 71 | 72 | Based on [`node:10-wheezy`](https://hub.docker.com/r/library/node/tags/10-wheezy/). 73 | 74 | #### [`node-9-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-9-debian/Dockerfile) 75 | 76 | Based on [`node:9-wheezy`](https://hub.docker.com/r/library/node/tags/9-wheezy/). 77 | 78 | #### [`node-8-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-8-debian/Dockerfile) 79 | 80 | Based on [`node:8-wheezy`](https://hub.docker.com/r/library/node/tags/8-wheezy/). 81 | 82 | #### [`node-7-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-7-debian/Dockerfile) 83 | 84 | Based on[`node:7-wheezy`](https://hub.docker.com/r/library/node/tags/7-wheezy/). 85 | 86 | ### Other Images 87 | 88 | #### [`node-7.7-alpine`, `7.0-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-7.7-alpine/Dockerfile) 89 | 90 | [![stability-locked](https://img.shields.io/badge/stability-locked-4b0088.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#locked) Based on [`node:7.7-alpine`](https://hub.docker.com/r/library/node/tags/7-alpine/), it `node` v7.7 compiled from source. The `7.0-alpine` tagged version was accidentally upgraded over time to v7.7 and will remain so for the stability of existing users. 91 | 92 | #### [`node-6.9-alpine`, `6.9-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-6.9-alpine/Dockerfile) 93 | 94 | [![stability-locked](https://img.shields.io/badge/stability-locked-4b0088.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#locked) Based on [`alpine:3.4`](https://hub.docker.com/r/library/alpine/tags/3.4/) with `node` v6.9 compiled from source. 95 | 96 | #### [`node-7.0-debian`, `7.0-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-7.0-debian/Dockerfile) 97 | 98 | [![stability-locked](https://img.shields.io/badge/stability-locked-4b0088.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#locked) Based on[`node:7.0-wheezy`](https://hub.docker.com/r/library/node/tags/7.0-wheezy/). 99 | 100 | #### [`node-6.9-debian`, `6.9-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-6.9-debian/Dockerfile) 101 | 102 | [![stability-locked](https://img.shields.io/badge/stability-locked-4b0088.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#locked) Based on[`node:6.9-wheezy`](https://hub.docker.com/r/library/node/tags/6.9-wheezy/). 103 | 104 | ## About 105 | 106 | Essentially, this is just a set of [shell scripts](https://github.com/mkenney/docker-npm/tree/master/bin) that manage a [Node.js](https://nodejs.org/) docker image. The docker image includes a script ([`run-as-user`](https://github.com/mkenney/docker-scripts/tree/master/container)) that allows commands to write files as either the current user or the owner/group of the current directory, which the shell scripts take advantage of to make sure files are created with your preferred permissions rather than root. 107 | 108 | #### Images & Wrapper Scripts 109 | 110 | The [images](https://hub.docker.com/r/mkenney/npm/tags/) contain the latest stable `bower`, `generate-md`, `grunt`, `gulp`, `node`, `npm`, `npx`, and `yarn`, binaries for [`node`](https://hub.docker.com/_/node/). When using the [shell scripts](https://github.com/mkenney/docker-npm/tree/master/bin) available in the [source repository](https://github.com/mkenney/docker-npm), the current directory is mounted into `/src` inside the container and a [wrapper script](https://github.com/mkenney/docker-scripts/blob/master/container/run-as-user) executes the specified command as a user who's `uid` and `gid` matches those properties on that directory. This way any output is written as the directory owner/group instead of root or a random user. 111 | 112 | The included [`run-as-user`](https://github.com/mkenney/docker-scripts/tree/master/container) script has three methods of determining which `uid` and `gid` to execute as: 113 | 114 | * By default, it will execute with a `uid` and `gid` that matches the current directory (the one that gets mounted into `/src`). 115 | * In order to take advantage of public key authentication when installing packages from private repositories, all the wrapper scripts will attempt to mount your `~/.ssh` directory into the container. When that is successful, the script will run as the `uid` and `gid` of the owner of `~/.ssh` (you). 116 | 117 | Most software that takes advantage of public key authentication protocols do so over SSH, and by default, send the current user name as the login name. Because this process is executing out of a segregated container, it knows nothing about the current user's name and will instead try to login as a user named `dev`. In order to work around this, you need to create a SSH configuration that specifies the correct username. 118 | 119 | In your `~/.ssh` folder create a file called `config`. In that file you need to specify the correct username. For example, to specify your login name for all hosts: 120 | 121 | ```txt 122 | Host * 123 | User mkenney 124 | ``` 125 | 126 | You can easily be more explicit as well, specifying by host or with additional wildcards. [Google is your friend](https://duckduckgo.com/?q=ssh+config+file). 127 | 128 | ```txt 129 | Host github.com 130 | User mkenney 131 | ``` 132 | 133 | * You can also explicitly specify the `uid` and `gid` to use at runtime by defining the `PUID` and `PGID` environment variables when executing the container, this is quite useful in automated build systems: 134 | 135 | ```txt 136 | docker run \ 137 | --rm \ 138 | -it \ 139 | -v $(pwd):/src:rw \ 140 | -e "PUID=" \ 141 | -e "PGID=" \ 142 | mkenney/npm:latest 143 | ``` 144 | 145 | The included [wrapper scripts](https://github.com/mkenney/docker-npm/blob/master/bin) default to the latest node version and image tag I feel is stable, I will update the default tag as updates are released or stability issues warrant (`node-10-alpine` at the moment). 146 | 147 | To specify a different image, you can define the image tag in your environment which will set a new default (you probably want to define this in your `.bashrc` or similar profile script): 148 | ```txt 149 | export DOCKER_NPM_TAG=node-6.9-alpine 150 | ``` 151 | 152 | or you can easily specify it at runtime whenever necessary, for example: 153 | ```txt 154 | $ DOCKER_NPM_TAG=node-6.9-alpine bower install 155 | ``` 156 | 157 | If you would to see like additional node modules and/or wrapper scripts added to this project please feel free to [create an issue](https://github.com/mkenney/docker-npm/issues) or [open a pull request](https://github.com/mkenney/docker-npm/pull/new/master). 158 | 159 | #### Installation 160 | 161 | This assumes that you already have [Docker](https://www.docker.com) installed. A running `docker` daemon is required. You probably want to be able to [run docker commands without sudo](https://docs.docker.com/engine/installation/linux/linux-postinstall/), but even if you excute the scripts with sudo files will be written with the appropriate `uid` and `gid`. 162 | 163 | Wrapper scripts for several commands are available in the source repository: 164 | 165 | * [`bower`](https://github.com/mkenney/docker-npm/blob/master/bin/bower) 166 | * [`generate-md`](https://github.com/mkenney/docker-npm/blob/master/bin/generate-md) 167 | * [`grunt`](https://github.com/mkenney/docker-npm/blob/master/bin/grunt) 168 | * [`gulp`](https://github.com/mkenney/docker-npm/blob/master/bin/gulp) 169 | * [`node`](https://github.com/mkenney/docker-npm/blob/master/bin/node) 170 | * [`npm`](https://github.com/mkenney/docker-npm/blob/master/bin/npm) 171 | * [`npx`](https://github.com/mkenney/docker-npm/blob/master/bin/npx) 172 | * [`yarn`](https://github.com/mkenney/docker-npm/blob/master/bin/yarn) 173 | 174 | Installation is just a matter of putting them somewhere in your path and making them executable. An [installation script](https://github.com/mkenney/docker-npm/blob/master/bin/install.sh) is available and can be executed with a shell `curl`+`sh -s` command. Simply pass in your command arguments normally. 175 | 176 | ``` 177 | Usage 178 | install.sh COMMAND [TAG [PREFIX]] 179 | 180 | Synopsys 181 | Install a mkenney/npm container execution script locally 182 | 183 | Options 184 | COMMAND - Required, the name of the command to install (bower, gulp, npm, etc.) 185 | TAG - Optional, the image tag to use. Default 'latest' 186 | PREFIX - Optional, the location to install the command script. Default '$HOME/bin' 187 | 188 | Examples 189 | $ curl -L https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh | bash -s gulp node-10-alpine $HOME/bin 190 | $ bash ./install.sh gulp node-10-alpine $HOME/bin 191 | ``` 192 | 193 | ##### Updating 194 | 195 | * `[command] self-update` 196 | 197 | Each of the scripts have a `self-update` command which pulls down the latest docker image (which all the scripts share) and then updates the shell script itself. If you don't have write permissions on the shell script you'll get a permissions error, you can run the self-update command with `sudo` if necessary. 198 | --------------------------------------------------------------------------------