-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (35 loc) · 1.08 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (35 loc) · 1.08 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
FROM node:alpine AS builder
ARG BUILD_CONTEXT
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn set version berry
COPY . .
RUN echo "Pruning: $BUILD_CONTEXT"
RUN yarn dlx turbo prune --scope=$BUILD_CONTEXT --docker
# Add lockfile and package.json's of isolated subworkspace
FROM node:alpine AS installer
ARG BUILD_CONTEXT
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY .yarnrc.yml ./
COPY .yarn ./.yarn
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN echo "Installing: $BUILD_CONTEXT"
RUN yarn install
# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN echo "Building: $BUILD_CONTEXT"
RUN yarn turbo run build --filter=${BUILD_CONTEXT}... --include-dependencies --no-deps
FROM node:alpine AS runner
WORKDIR /app
COPY --from=installer /app .
EXPOSE 1-65000
# TODO: Eventually make this file a template and pass in the command
CMD node apps/api/dist/src/main.js