Inspired by https://semaphoreci.com/community/tutorials/dockerizing-a-node-js-web-application
1.1K
Place the following Dockerfile in your Node.js application directory and docker build it.
# Dockerfile
# The FROM directive sets the Base Image for subsequent instructions
FROM qlurkin/nodejs:latest
# Add our package.json and install *before* adding our application files (WORDIR is set to /var/www/app/current)
ADD package.json ./
RUN npm i --production
# Add application files
ADD . .
#Expose the port
EXPOSE 4500
CMD ["pm2", "start", "processes.json", "--no-daemon"]
# the --no-daemon is a minor workaround to prevent the docker container from thinking pm2 has stopped running and ending itself
Content type
Image
Digest
Size
174.4 MB
Last updated
about 10 years ago
docker pull qlurkin/nodejs