Alpine NodeJS image that can generate minimal images for production or loaded dev images for dev.
50K+
This contains two Dockerfiles, one for installing dependencies and building, the other for actually running your app.
The result will be an extremely small dockerized version of your app (hopefully) fit for production.
Most NodeJS projects require the same common things for successful install and build. Most NodeJS developers don't have the time to spend putting together a clean Alpine build. This is to save myself and others the headache of digging up their specific projects build dependencies and produce a nice minimal Alpine image to brag about to all their friends.
docker run --privileged --rm --name build_web_proxy
-v "/path/to/project/src":/app
-v /var/run/docker.sock:/var/run/docker.sock
stevenaldinger/alpine-nodejs-dev:latest
docker run --privileged --rm --name build_web_proxy
-e NPM_TOKEN='0a0b00cd-1a2b-0000-0000-0000000000'
-v "/path/to/project/src":/app
-v /var/run/docker.sock:/var/run/docker.sock
stevenaldinger/alpine-nodejs-dev:latest
docker run -it --rm --name custom_entry
-e NPM_TOKEN='0a0b00cd-1a2b-0000-0000-0000000000'
-v "$(pwd)/ui":'/app'
-v "$(pwd)/my_entrypoint.sh":'/usr/bin/custom_entrypoint'
stevenaldinger/alpine-nodejs-dev:latest
docker run --privileged --rm --name build_app
-e APP_SRC=/app
-e APP_NAME='my app name'
-e BUILD_SCRIPT='build'
-e DOCKER_CMD='node index'
-e FORCE_NPM_INSTALL='false'
-e NPM_TOKEN='0a0b00cd-1a2b-0000-0000-0000000000'
-e NODE_SASS_FIX='true'
-v "/path/to/project/src":/app
-v /var/run/docker.sock:/var/run/docker.sock
stevenaldinger/alpine-nodejs-dev:
# ============================== CONFIG OPTIONS ============================== #
# Environment Variable | Default | Required | Description #
# ---------------------------------------------------------------------------- #
# APP_SRC | "/app" | No | Mounted volume, expected #
# | | | to have a package.json #
# ---------------------------------------------------------------------------- #
# APP_NAME |from pkg.json | No | Name of build subdir #
# ---------------------------------------------------------------------------- #
# BUILD_SCRIPT | "build" | No | Set npm run build script #
# ---------------------------------------------------------------------------- #
# COPY_DIR | "." | No | Specific dir to copy to #
# | | | docker image (ex: dist) #
# ---------------------------------------------------------------------------- #
# DOCKER_CMD |npm run start | No | Command for docker to #
# | | | execute on start #
# ---------------------------------------------------------------------------- #
# DOCKERFILE_NAME | "D..minimal" | No | Name of generated #
# | | | Dockerfile #
# ---------------------------------------------------------------------------- #
# FORCE_NPM_INSTALL | 'false' | No | If not set, will skip npm #
# | | | install if node_modules #
# | | | dir exists and #
# | | | package.json has no #
# | | | detected changes #
# ---------------------------------------------------------------------------- #
# IMAGE_NAME | ${APP_NAME} | No | Name of built image #
# ---------------------------------------------------------------------------- #
# IMAGE_VERSION | none | No | If you want a version #
# | | | tag other than 'latest' #
# ---------------------------------------------------------------------------- #
# NPM_TOKEN | none | No | NPM_TOKEN to be used for #
# | | | accessing private modules #
# ---------------------------------------------------------------------------- #
# NODE_SASS_FIX | auto-detect | No | Set to "false" to opt out #
# | | | of node-sass fix (v4.5.3) #
# ============================ END CONFIG OPTIONS ============================ #
Based on mhart/alpine-node, extended with glibc compatibility.
The builder image has these NodeJS modules:
And these Alpine packages:
The minimal image contains only(ish) node, npm, and the libc6-compat package.
Content type
Image
Digest
Size
182.5 MB
Last updated
about 9 years ago
docker pull stevenaldinger/alpine-nodejs-dev