update dockerfile to support test stage
This commit is contained in:
parent
dd72f8e165
commit
6b0e84669a
15
Dockerfile
15
Dockerfile
@ -1,11 +1,22 @@
|
|||||||
FROM node:alpine as Build
|
FROM node:alpine as files
|
||||||
ENV NODE_ENV=production
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY [ "package-lock.json", "package.json", "index.ts", "tsconfig.json", "./" ]
|
COPY [ "package-lock.json", "package.json", "index.ts", "tsconfig.json", "./" ]
|
||||||
COPY server ./server
|
COPY server ./server
|
||||||
|
|
||||||
|
FROM files as proddependencies
|
||||||
|
ENV NODE_ENV=production
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
FROM proddependencies as compile
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
CMD ["npm","run","start"]
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user