From 6b0e84669a70a30e9e6c4271dbda065ca1c0744e Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 24 Jun 2023 20:09:09 +0200 Subject: [PATCH] update dockerfile to support test stage --- Dockerfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e765732..8b0b04b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,22 @@ -FROM node:alpine as Build -ENV NODE_ENV=production +FROM node:alpine as files WORKDIR /app COPY [ "package-lock.json", "package.json", "index.ts", "tsconfig.json", "./" ] COPY server ./server +FROM files as proddependencies +ENV NODE_ENV=production RUN npm ci --omit=dev +FROM proddependencies as compile RUN npm run build CMD ["npm","run","start"] + +FROM files as dependencies +RUN npm ci + +FROM dependencies as test +COPY jest.config.js . +COPY tests ./tests + +RUN npm run test