AlpineLinux-base Docker image with NodeJS 4.3.0+ and Java 8
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 \ dionakra/nodejs-java8
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 dionakra/nodejs-java8:onbuild EXPOSE 5080
To permanently install additional AlpineLinux packages, place one package name per line into
./deps.apk
. Applies tolatest
as well asonbuild
.
For custom actions, create deps.sh executable script.
For build-time only dependencies (e.g.bson
npm package requiresmake
andg++
to compile c++ extention), use./deps_build.apk
. All packages will be installed beforenpm install
and removed immediately after, for the sake of making resulting image smaller. Applies tolatest
as well asonbuild
, except thatlatest
will not cleanup the build-time dependencies.
NOTE:
latest
tries to resolve dependencies duringdocker run
, before runningnpm install && npm start
(assuming you did not override theCMD
)onbuild
resolves dependencies duringdocker build
, cleans up build-time dependencies and the only command executed duringdocker run
isnpm start
(assuming you did not override theCMD
)
Add ./examples