generated from well-known-components/template-server
-
Notifications
You must be signed in to change notification settings - Fork 0
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
d1b2885
commit 11d32fb
Showing
3 changed files
with
206 additions
and
204 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 @@ | ||
v20.18.0 |
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 |
---|---|---|
@@ -1,44 +1,45 @@ | ||
ARG RUN | ||
|
||
FROM node:lts as builderenv | ||
FROM node:20-alpine as builderenv | ||
|
||
WORKDIR /app | ||
|
||
# some packages require a build step | ||
RUN apt-get update && apt-get -y -qq install build-essential | ||
|
||
# We use Tini to handle signals and PID1 (https://github.com/krallin/tini, read why here https://github.com/krallin/tini/issues/8) | ||
ENV TINI_VERSION v0.19.0 | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini | ||
RUN chmod +x /tini | ||
|
||
# install dependencies | ||
COPY package.json /app/package.json | ||
COPY yarn.lock /app/yarn.lock | ||
RUN yarn | ||
RUN apk update && apk add wget | ||
|
||
# build the app | ||
COPY . /app | ||
RUN yarn install --frozen-lockfile | ||
RUN yarn build | ||
RUN yarn test | ||
|
||
# remove devDependencies, keep only used dependencies | ||
RUN yarn install --frozen-lockfile --production | ||
RUN yarn install --prod --frozen-lockfile | ||
|
||
########################## END OF BUILD STAGE ########################## | ||
|
||
FROM node:lts | ||
FROM node:20-alpine | ||
|
||
RUN apk update && apk add --update wget && apk add --update tini | ||
|
||
# NODE_ENV is used to configure some runtime options, like JSON logger | ||
ENV NODE_ENV production | ||
|
||
ARG COMMIT_HASH=local | ||
ENV COMMIT_HASH=${COMMIT_HASH:-local} | ||
|
||
ARG CURRENT_VERSION=Unknown | ||
ENV CURRENT_VERSION=${CURRENT_VERSION:-Unknown} | ||
|
||
WORKDIR /app | ||
COPY --from=builderenv /app /app | ||
COPY --from=builderenv /tini /tini | ||
|
||
RUN echo "" > /app/api/.env | ||
RUN echo "" > /app/processor/.env | ||
|
||
# Please _DO NOT_ use a custom ENTRYPOINT because it may prevent signals | ||
# (i.e. SIGTERM) to reach the service | ||
# Read more here: https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/ | ||
# and: https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/ | ||
ENTRYPOINT ["/tini", "--"] | ||
ENTRYPOINT ["tini", "--"] | ||
# Run the program under Tini | ||
CMD [ "/usr/local/bin/node", "--trace-warnings", "--abort-on-uncaught-exception", "--unhandled-rejections=strict", "dist/index.js" ] |
Oops, something went wrong.