Skip to content

Commit

Permalink
production switch to debian for proper lsof support
Browse files Browse the repository at this point in the history
  • Loading branch information
majodev committed May 26, 2023
1 parent 831e96b commit b42b8eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dist
npm-debug.log
.tscache
tscommand-
/tmp
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends \
curl \
git \
libssl-dev \
lsof \
tini \
wget \
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -59,13 +61,16 @@ RUN yarn install --production --ignore-scripts --prefer-offline
# --- Stage: production
# --- Purpose: Final step from a new slim image. this should be a minimal image only housing dist (production service)
### -----------------------

FROM node:18.16.0-alpine AS production
FROM node:18.16.0-bullseye AS production

# https://github.com/nodejs/docker-node/blob/7de353256a35856c788b37c1826331dbba5f0785/docs/BestPractices.md
# Node.js was not designed to run as PID 1 which leads to unexpected behaviour when running inside of Docker.
# You can also include Tini directly in your Dockerfile, ensuring your process is always started with an init wrapper.
RUN apk add --no-cache tini
RUN apt-get update && apt-get install -y -q --no-install-recommends \
ca-certificates \
lsof \
tini \
&& rm -rf /var/lib/apt/lists/*

USER node
WORKDIR /app
Expand All @@ -79,5 +84,5 @@ COPY --chown=node:node --from=builder /app/dist /app/dist
ENV NODE_ENV=production

EXPOSE 8080
ENTRYPOINT ["/sbin/tini", "--"]
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["node","dist/server/app.js"]

0 comments on commit b42b8eb

Please sign in to comment.