Skip to content

Commit

Permalink
chore: multi-stage build for checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Oct 10, 2024
1 parent b7b8979 commit 44af6b6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/checkout/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 run build
RUN npm ci -f && npm cache clean --force
USER node


FROM public.ecr.aws/amazonlinux/amazonlinux:2023

# We tell DNF not to install Recommends and Suggests packages, which are
Expand Down Expand Up @@ -26,12 +35,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" ]

0 comments on commit 44af6b6

Please sign in to comment.