mkenney / docker-npm

npm, yarn, node, npx, bower, grunt, gulp, generate-md - build and dev tools.
MIT License
53 stars 28 forks source link
bower build-tools developer-tools devops docker grunt gulp markdown node npm yarn

docker-badges.webbedlam.com

npm and related build and dev tools

MIT License stability-mature Build status Github issues Github pull requests

Please feel free to create an issue or open a pull request if you need support or would like to contribute.

Portable node, package managers and build tools

Announcements

v1.1.0 released

2019-02-25

Tagged Images

Images are tagged according to the installed Node version and operating system. Package versions are not pinned, instead npm 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 if you run into this situation.

Alpine

alpine, latest Dockerfile

Based on node:alpine. This image should be considered under development and may not be as stable as versioned images.

node-11-alpine Dockerfile

Based on node:11-alpine.

node-10-alpine Dockerfile

Based on node:10-alpine.

node-9-alpine Dockerfile

Based on node:9-alpine.

node-8-alpine Dockerfile

Based on node:8-alpine.

node-7-alpine Dockerfile

Based on node:7-alpine.

node-6-alpine Dockerfile

Based on node:6-alpine.

Debian

debian Dockerfile

Based on node:latest. This image should be considered under development and may not be as stable as versioned images.

node-11-debian Dockerfile

Based on node:11-stretch.

node-10-debian Dockerfile

Based on node:10-wheezy.

node-9-debian Dockerfile

Based on node:9-wheezy.

node-8-debian Dockerfile

Based on node:8-wheezy.

node-7-debian Dockerfile

Based onnode:7-wheezy.

Other Images

node-7.7-alpine, 7.0-alpine Dockerfile

stability-locked Based on node:7.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.

node-6.9-alpine, 6.9-alpine Dockerfile

stability-locked Based on alpine:3.4 with node v6.9 compiled from source.

node-7.0-debian, 7.0-debian Dockerfile

stability-locked Based onnode:7.0-wheezy.

node-6.9-debian, 6.9-debian Dockerfile

stability-locked Based onnode:6.9-wheezy.

About

Essentially, this is just a set of shell scripts that manage a Node.js docker image. The docker image includes a script (run-as-user) 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.

Images & Wrapper Scripts

The images contain the latest stable bower, generate-md, grunt, gulp, node, npm, npx, and yarn, binaries for node. When using the shell scripts available in the source repository, the current directory is mounted into /src inside the container and a wrapper script 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.

The included run-as-user script has three methods of determining which uid and gid to execute as:

The included wrapper scripts 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).

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):

export DOCKER_NPM_TAG=node-6.9-alpine

or you can easily specify it at runtime whenever necessary, for example:

$ DOCKER_NPM_TAG=node-6.9-alpine bower install

If you would to see like additional node modules and/or wrapper scripts added to this project please feel free to create an issue or open a pull request.

Installation

This assumes that you already have Docker installed. A running docker daemon is required. You probably want to be able to run docker commands without sudo, but even if you excute the scripts with sudo files will be written with the appropriate uid and gid.

Wrapper scripts for several commands are available in the source repository:

Installation is just a matter of putting them somewhere in your path and making them executable. An installation script is available and can be executed with a shell curl+sh -s command. Simply pass in your command arguments normally.

Usage
  install.sh COMMAND [TAG [PREFIX]]

Synopsys
  Install a mkenney/npm container execution script locally

Options
  COMMAND  - Required, the name of the command to install (bower, gulp, npm, etc.)
  TAG      - Optional, the image tag to use. Default 'latest'
  PREFIX   - Optional, the location to install the command script. Default '$HOME/bin'

Examples
  $ curl -L https://raw.githubusercontent.com/mkenney/docker-npm/master/bin/install.sh | bash -s gulp node-10-alpine $HOME/bin
  $ bash ./install.sh gulp node-10-alpine $HOME/bin
Updating