Linux Docker images for Node.js with best practices in mind:
- proper signal-forwarding for
su
andsudo
, - using unprivileged users for running apps.
Currently supported distributions:
- Debian
- Alpine
FROM godaddy/node:8.9.4-debian
ENV NODE_ENV=production # or anything else
RUN mkdir /app
WORKDIR /app
COPY docker/.npmrc package.json package-lock.json /app/
RUN npm install
# Copy app to source directory
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
COPY . /app/
EXPOSE 8080
CMD ["gosu", "node", "npm", "start"]
#!/bin/sh
# here you can customize how your app should start up
set -e
exec "$@"
To grab the images, visit our Docker Hub profile.