Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
refactor(image): common layer for installing tini
Browse files Browse the repository at this point in the history
  • Loading branch information
PixnBits committed Apr 16, 2024
1 parent 108b4b1 commit db7e489
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ RUN NODE_ENV=production npm run build && \
mv /opt/build/bundle.integrity.manifest.json /opt/one-app/production && \
mv /opt/build/.build-meta.json /opt/one-app/production

# development image
# docker build . --target=development
FROM node:18.20.1-alpine as development
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
FROM node:18.20.1-alpine as node-tini
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]

# development image
# docker build . --target=development
FROM node-tini as development
ARG USER
ENV USER ${USER:-node}
ENV NODE_ENV=development
Expand All @@ -50,10 +52,7 @@ COPY --from=builder --chown=node:node /opt/one-app/development ./

# production image
# last so that it's the default image artifact
FROM node:18.20.1-alpine as production
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
FROM node-tini as production
ARG USER
ENV USER ${USER:-node}
ENV NODE_ENV=production
Expand Down

0 comments on commit db7e489

Please sign in to comment.