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.
feat: Use node 18 alpine image (#28)
* feat: Dockerfile with Node 20 * feat: Use Node 18 Alpine * chore: Main lock * fix: copy paste error * Update Dockerfile Signed-off-by: Kevin Szuchet <31735779+kevinszuchet@users.noreply.github.com> * Update Dockerfile Signed-off-by: Kevin Szuchet <31735779+kevinszuchet@users.noreply.github.com> * Update Dockerfile Signed-off-by: Kevin Szuchet <31735779+kevinszuchet@users.noreply.github.com> --------- Signed-off-by: Kevin Szuchet <31735779+kevinszuchet@users.noreply.github.com>
- Loading branch information
1 parent
079da11
commit d48f6ed
Showing
2 changed files
with
18 additions
and
18 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 @@ | ||
v18.20.4 |
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,43 @@ | ||
ARG RUN | ||
|
||
FROM node:lts as builderenv | ||
FROM node:18-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 --no-cache 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:18-alpine | ||
|
||
RUN apk update && apk add --no-cache wget 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/.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" ] |