-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
39 lines (30 loc) · 926 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM node:19
ENV NODE_ENV development
WORKDIR /turvis
COPY src src
COPY package.json package.json
RUN npm i -g npm@latest
ENTRYPOINT ["npm", "start"]
FROM node:19 AS base
RUN mkdir /turvis
RUN chown node:node /turvis
USER node
WORKDIR /turvis
COPY --chown=node:node package.json ./
# Install production dependencies
FROM base AS dependencies
COPY --chown=node:node .npmrc package-lock.json ./
RUN npm ci --production
# Install development dependencies and build
FROM dependencies AS build
RUN npm ci
COPY --chown=node:node src ./src
COPY --chown=node:node tsconfig.build.json tsconfig.json ./
RUN npm run build
# Copy production dependencies, build artifacts and runtime configuration and run
FROM base
ENV NODE_ENV=dev
COPY --chown=node:node --from=dependencies /turvis/node_modules ./node_modules
COPY --chown=node:node --from=build /turvis/dist ./dist
COPY --chown=node:node config ./config
CMD npm run start:prod