diff --git a/src/checkout/Dockerfile b/src/checkout/Dockerfile index f74f79ee5..f8629bbcd 100644 --- a/src/checkout/Dockerfile +++ b/src/checkout/Dockerfile @@ -1,3 +1,12 @@ +FROM node:20-alpine AS build +WORKDIR /usr/src/app +COPY --chown=node:node package*.json ./ +COPY --chown=node:node . . +RUN npm ci -f +RUN npm run build +USER node + + FROM public.ecr.aws/amazonlinux/amazonlinux:2023 # We tell DNF not to install Recommends and Suggests packages, which are @@ -5,7 +14,6 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2023 # packages as minimal as possible. RUN dnf --setopt=install_weak_deps=False install -q -y \ nodejs20 \ - npm \ shadow-utils \ && \ dnf clean all @@ -26,12 +34,7 @@ RUN useradd \ WORKDIR /app USER appuser -COPY --chown=appuser:appuser package.json . -COPY --chown=appuser:appuser package-lock.json . - -RUN npm ci - -ADD . /app -RUN npm run build +COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules +COPY --chown=node:node --from=build /usr/src/app/dist ./dist -ENTRYPOINT [ "node", "dist/main.js" ] +ENTRYPOINT [ "node", "dist/main.js" ] \ No newline at end of file