-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 12.14.1-v1 tag for node-prod image
Signed-off-by: Eric Dobbertin <eric@dairystatedesigns.com>
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |