Skip to content

Commit

Permalink
feat: add 12.14.1-v1 tag for node-prod image
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dobbertin <eric@dairystatedesigns.com>
  • Loading branch information
aldeed committed Jan 14, 2020
1 parent 83fc6a7 commit bdd72ee
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions images/node-prod/12.14.1-v1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM node:12.14.1-alpine

# hadolint ignore=DL3018
RUN apk --no-cache add bash curl less tini vim make python2
SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-u", "-c"]

WORKDIR /usr/local/src/app
ENV PATH=$PATH:/usr/local/src/app/node_modules/.bin

# Allow yarn/npm to create ./node_modules
RUN chown node:node .

# Install the latest version of NPM (as of when this
# base image is built)
RUN npm i -g npm@latest

# Copy specific things so that we can keep the image
# as small as possible without relying on each repo
# to include a .dockerignore file.
#
# Note that there is a reason these are on separate lines.
# COPY command will fail unless at least one file exists
# So we put LICENSE* on the same line as package-lock.json,
# effectively making it optional to have a LICENSE file.
# But the others are on their own line so that the build
# will fail if they are not present in the project.
ONBUILD COPY --chown=node:node package.json ./
ONBUILD COPY --chown=node:node package-lock.json LICENSE* ./
ONBUILD COPY --chown=node:node ./src ./src

USER node

# Install dependencies
ONBUILD RUN npm ci --only=prod --ignore-scripts

# If any Node flags are needed, they can be set in
# the NODE_OPTIONS env variable.
#
# NOTE: We would prefer to use `node .` but relying on
# Node to look up the `main` path is currently broken
# when ECMAScript module support is enabled. When this
# is fixed, change command to:
#
# CMD ["tini", "--", "node", "."]
#
CMD ["tini", "--", "npm", "start"]

0 comments on commit bdd72ee

Please sign in to comment.