-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (28 loc) · 1006 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
# layer with all devDependencies
FROM node:20-alpine as devDependencies
WORKDIR /usr/src/wishing-well
COPY package.json package-lock.json ./
RUN npm ci
# layer with prod-dependencies only
FROM node:20-alpine as dependencies
WORKDIR /usr/src/wishing-well
COPY package.json package-lock.json ./
COPY --from=devDependencies /usr/src/wishing-well/node_modules node_modules
RUN npm prune --omit=dev
# builder image where we compile, i.e. create the dist artifact
FROM node:20-alpine as builder
WORKDIR /usr/src/wishing-well
ENV PATH=$PATH:./node_modules/.bin
COPY --from=devDependencies /usr/src/wishing-well/node_modules node_modules
COPY . .
RUN tsc -p tsconfig.dist.json
# final image
FROM node:20-alpine
ARG GIT_REVISION
ENV NODE_ENV=production
USER node
WORKDIR /usr/local/wishing-well
COPY --from=dependencies /usr/src/wishing-well/node_modules node_modules
COPY --from=builder /usr/src/wishing-well/dist dist
ENV GIT_REVISION=$GIT_REVISION
CMD node -r source-map-support/register dist/index.js