-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.dockerfile
More file actions
52 lines (31 loc) · 1.03 KB
/
node.dockerfile
File metadata and controls
52 lines (31 loc) · 1.03 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM node:lts-alpine AS base
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
ARG SCOPE
ENV SCOPE=${SCOPE}
ENV YARN_CACHE_FOLDER=.yarn-cache
FROM base as pruner
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=${SCOPE} --docker
FROM base as development
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/yarn.lock ./yarn.lock
RUN yarn install --frozen-lockfile
FROM base as production
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/yarn.lock ./yarn.lock
COPY --from=development /app/${YARN_CACHE_FOLDER} /${YARN_CACHE_FOLDER}
RUN yarn install --frozen-lockfile --production --prefer-offline --ignore-scripts
RUN rm -rf /app/${YARN_CACHE_FOLDER}
FROM base AS builder
COPY --from=development /app/ .
COPY --from=pruner /app/out/full/ .
RUN yarn turbo run build --scope=${SCOPE} --include-dependencies --no-deps
RUN find . -name node_modules | xargs rm -rf
FROM base AS runner
COPY --from=production /app/ .
COPY --from=builder /app/ .
CMD yarn workspace ${SCOPE} launch
EXPOSE 3000