Skip to content

Instantly share code, notes, and snippets.

@mousetree
Last active July 11, 2018 09:39
Show Gist options
  • Save mousetree/2b894b0a1dcbf0a0055071fc51f06bbc to your computer and use it in GitHub Desktop.
Save mousetree/2b894b0a1dcbf0a0055071fc51f06bbc to your computer and use it in GitHub Desktop.
Dockerfile with build number as env var
FROM node:10
ARG COMMIT_REF
ARG BUILD_DATE
# Create app directory
WORKDIR /usr/src/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 ./
# At this point we just have the package.json files
RUN npm install
# Bundle app source
COPY . .
# Run any other build steps such as `npm run build`
ENV APP_COMMIT_REF=${COMMIT_REF} \
APP_BUILD_DATE=${BUILD_DATE}
EXPOSE 3000
CMD [ "npm", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment