From 6be206ff28dadfdc2f282c053f719b5f24123828 Mon Sep 17 00:00:00 2001 From: brtwrst <6873862+brtwrst@users.noreply.github.com> Date: Tue, 3 May 2022 06:17:28 +0000 Subject: [PATCH] Move alpine build to Dockerfile.alpine; add tini to debian Dockerfile --- Dockerfile | 17 +++++++---------- Dockerfile.alpine | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 Dockerfile.alpine diff --git a/Dockerfile b/Dockerfile index 5252376..83f769e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,15 @@ -FROM alpine as base - -RUN apk add --no-cache nodejs yarn openssl tini -RUN mkdir /app +FROM node:16-bullseye as base +RUN apt-get update && apt-get install -y openssl WORKDIR /app ENV NODE_ENV=production ADD yarn.lock package.json ./ +RUN npm rebuild bcrypt --build-from-source RUN yarn install --production -FROM alpine as prod - -RUN apk add --no-cache nodejs yarn openssl tini +FROM node:16-bullseye-slim as prod +RUN apt-get update && apt-get install openssl tini && apt-get clean -y && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=base /app /app ADD . . - -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["yarn", "start"] +ENTRYPOINT ["/usr/bin/tini","-g", "--"] +CMD ["node", "app.js"] diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 0000000..32f582c --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,15 @@ +FROM alpine as base +RUN apk add --no-cache nodejs yarn npm python3 openssl build-base +WORKDIR /app +ENV NODE_ENV=production +ADD yarn.lock package.json ./ +RUN npm rebuild bcrypt --build-from-source +RUN yarn install --production + +FROM alpine as prod +RUN apk add --no-cache nodejs yarn openssl tini +WORKDIR /app +COPY --from=base /app /app +ADD . . +ENTRYPOINT ["/sbin/tini","-g", "--"] +CMD ["node", "app.js"]