Debian Docker images for Node.js with best practices in mind:
- proper signal-forwarding for
su
andsudo
, - using unprivileged users for running apps.
FROM godaddy/node:8.9.4-debian
ENV NODE_ENV=production # or anything else
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", "alone", "npm", "start"]
#!/bin/sh
# here you can customize how your app should start up
set -e
cd /app
chown alone:alone /app
exec "$@"
To grab the images, visit our Docker Hub profile.