Skip to content

Commit

Permalink
switch to distroless image
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorwolf committed Feb 2, 2024
1 parent 18cab09 commit 27d5988
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
FROM ubuntu:22.04
FROM node:20 AS build-env
WORKDIR /app

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get --no-install-recommends -y install nodejs npm curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& nodejs -v \
&& npm -v
WORKDIR /usr/src/app
COPY package.json .
COPY package-lock.json .
RUN npm ci
COPY db db/
COPY srv srv/
COPY srv/gen/srv/csn.json srv/
#COPY srv/gen/srv/csn.json srv/
COPY app app/

FROM gcr.io/distroless/nodejs20-debian12
COPY --from=build-env /app /app
WORKDIR /app
EXPOSE 4004
HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f http://localhost:4004/ || exit 1
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
USER node
CMD [ "npm", "start" ]

0 comments on commit 27d5988

Please sign in to comment.