Skip to content

Instantly share code, notes, and snippets.

@nam20485
Created February 20, 2021 22:12
Show Gist options
  • Save nam20485/9ec6f7e99434f073075e1ca0318e1333 to your computer and use it in GitHub Desktop.
Save nam20485/9ec6f7e99434f073075e1ca0318e1333 to your computer and use it in GitHub Desktop.
Installing node (& npm) on a mongo:4.0-xenial docker base image
# base image uses node latest minor version of 12.m
#FROM node:12-stretch-slim
FROM mongo:4.0-xenial
# create and set cwd
WORKDIR /code
# copy npm's package state files
COPY package.json .
COPY package-lock.json .
RUN apt update
RUN apt install -y curl sudo
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash -
RUN apt install -y nodejs
#RUN apt install npm
# install all required dependency packages (see package.json)
RUN npm install
# copy the project directory & code in
COPY . .
# prefer port 3001
EXPOSE 3001
# invoke 'npm start' command
ENTRYPOINT [ "npm", "start" ]
#CMD [ "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment