Skip to content

Instantly share code, notes, and snippets.

@YannMjl
Created June 1, 2021 16:08
Show Gist options
  • Save YannMjl/b8044a20de9d0f0a1f8ca7b15fa13376 to your computer and use it in GitHub Desktop.
Save YannMjl/b8044a20de9d0f0a1f8ca7b15fa13376 to your computer and use it in GitHub Desktop.
this is Dockerfile for a demo Nodejs express app
FROM node
LABEL authors="Yann Mulonda"
# update dependencies and install curl
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
# COPY package*.json ./ \
# ./source ./
# This will copy everything from the source path
# --more of a convenience when testing locally.
COPY . .
# update each dependency in package.json to the latest version
RUN npm install -g npm-check-updates \
ncu -u \
npm install \
npm install express \
npm install babel-cli \
npm install babel-preset \
npm install babel-preset-env
# If you are building your code for production
RUN npm ci --only=production
# Bundle app source
COPY . /app
EXPOSE 3000
CMD [ "babel-node", "app.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment