This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6eb83ac
commit beb66b7
Showing
2 changed files
with
61 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,16 @@ | ||
node_modules | ||
npm-debug.log | ||
.git | ||
.gitignore | ||
.cache | ||
*.md | ||
*.example | ||
LICENSE | ||
logo.* | ||
*.yaml | ||
*.png | ||
*.gif | ||
*.jpg | ||
*.bmpr | ||
*.sample | ||
.env* |
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,45 @@ | ||
# Base | ||
FROM node:12-slim as base | ||
ENV NODE=ENV=production | ||
ENV TINI_VERSION v0.18.0 | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini | ||
RUN chmod +x /tini | ||
EXPOSE 3000 | ||
RUN mkdir /app && chown -R node:node /app | ||
WORKDIR /app | ||
USER node | ||
COPY --chown=node:node package*.json ./ | ||
RUN npm install --no-optional --silent && npm cache clean --force > "/dev/null" 2>&1 | ||
|
||
# Development ENV | ||
FROM base as dev | ||
ENV NODE_ENV=development | ||
ENV PATH=/app/node_modules/.bin:$PATH | ||
RUN npm install --only=development --no-optional --silent && npm cache clean --force > "/dev/null" 2>&1 | ||
CMD ["nodemon", "server.js", "--inspect=0.0.0.0:9229"] | ||
|
||
# Source | ||
FROM base as source | ||
COPY --chown=node:node . . | ||
|
||
# Test ENV | ||
FROM source as test | ||
ENV NODE_ENV=development | ||
ENV PATH=/app/node_modules/.bin:$PATH | ||
COPY --from=dev /app/node_modules /app/node_modules | ||
RUN eslint . | ||
RUN npm test | ||
|
||
# Audit ENV | ||
FROM test as audit | ||
USER root | ||
RUN npm audit --audit-level critical | ||
ARG MICROSCANNER_TOKEN | ||
ADD https://get.aquasec.com/microscanner / | ||
RUN chmod +x /microscanner | ||
RUN /microscanner $MICROSCANNER_TOKEN --continue-on-failure | ||
|
||
# Production ENV | ||
FROM source as prod | ||
ENTRYPOINT ["/tini", "--"] | ||
CMD ["node", "server.js"] |