Move alpine build to Dockerfile.alpine; add tini to debian Dockerfile
This commit is contained in:
parent
c4badb9daf
commit
6be206ff28
2 changed files with 22 additions and 10 deletions
17
Dockerfile
17
Dockerfile
|
@ -1,18 +1,15 @@
|
||||||
FROM alpine as base
|
FROM node:16-bullseye as base
|
||||||
|
RUN apt-get update && apt-get install -y openssl
|
||||||
RUN apk add --no-cache nodejs yarn openssl tini
|
|
||||||
RUN mkdir /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ADD yarn.lock package.json ./
|
ADD yarn.lock package.json ./
|
||||||
|
RUN npm rebuild bcrypt --build-from-source
|
||||||
RUN yarn install --production
|
RUN yarn install --production
|
||||||
|
|
||||||
FROM alpine as prod
|
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/*
|
||||||
RUN apk add --no-cache nodejs yarn openssl tini
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=base /app /app
|
COPY --from=base /app /app
|
||||||
ADD . .
|
ADD . .
|
||||||
|
ENTRYPOINT ["/usr/bin/tini","-g", "--"]
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
CMD ["node", "app.js"]
|
||||||
CMD ["yarn", "start"]
|
|
||||||
|
|
15
Dockerfile.alpine
Normal file
15
Dockerfile.alpine
Normal file
|
@ -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"]
|
Loading…
Reference in a new issue