Other alternatives have the kitchen sink in the image. Not a great trade off between small images and reliability.
This docker image installs what is necessary and leaves the rest upto the developer to install. It's a simple "batteries included" version of production Node.js images.
This image has been built based on our experience in running over 1000s of containers executing Node.js apps.
- Docker layer caching for node_modules
- Tini as init process.
- ONBUILD triggers based on convention for simplifying application Dockerfile
- non sudo
node
user
All PRs and Issues welcome!
$ docker run ishaanmalhi/ubuntu-node:10 node --version
- For general use cases, you should use the full image. This includes build triggers that will copy the code in your home folder, install the npm dependencies and set the user to node.
FROM ishaanmalhi/ubuntu-node:10
# Expose app port
EXPOSE 3000
CMD ["node", "index"]
- If you know what native npm module dependencies you need, you should use the base images. They are about 200 MBs smaller than the full images since they don't contain the
build-essential
package, which is needed for generic node images.
FROM ishaanmalhi/ubuntu-node:base-10
RUN apt-get install make
COPY package*.json .
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["node", "index"]