Public | Automated Build

Last pushed: a month ago
Short Description
27MB NodeJS over AlpineLinux
Full Description

NodeJS in a box

AlpineLinux-base Docker image with NodeJS 4.3.0+

Usage

It's assumed that you have working ./package.json with resolvable dependencies and proper start script, so that npm install and npm start works.

  • without building an image:

      docker run -it --rm \
        --name my-node-project \
        -p 5080:5080 \
        -v $(pwd):/app \
        anapsix/nodejs
    

You should customize your EXPOSE [] according to server.js.
You can also add ENTRYPOINT, override CMD and add dependencies as needed.

  • building from onbuild tag:

      # Dockerfile
      FROM anapsix/nodejs:onbuild
      EXPOSE 5080
    

To permanently install additional AlpineLinux packages, place one package name per line into ./deps.apk.
Applies to latest as well as onbuild.
For custom actions, create deps.sh executable script.
For build-time only dependencies (e.g. bson npm package requires make and g++ to compile c++ extention), use ./deps_build.apk.
All packages will be installed before npm install and removed immediately after, for the sake of making resulting image smaller.
Applies to latest as well as onbuild, except that latest will not cleanup the build-time dependencies.

NOTE:

  • latest tries to resolve dependencies during docker run, before running npm install && npm start (assuming you did not override the CMD)
  • onbuild resolves dependencies during docker build, cleans up build-time dependencies and the only command executed during docker run is npm start (assuming you did not override the CMD)

TODO

Add ./examples

Docker Pull Command
Owner
anapsix
Source Repository

Comments (2)
anapsix
2 years ago

I've eagerly updated it to alpine:3.3, which has bad NodeJS package.. Just rolled it back to alpine:3.2.
Make sure to re-pull to get latest fixes.. Sorry about that.

zamarronstein
2 years ago

This image is very useful and lightweight to start with node.js... great job, thanks for share it.