-
Notifications
You must be signed in to change notification settings - Fork 47
/
Dockerfile
45 lines (37 loc) · 1.02 KB
/
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
40
41
42
43
44
45
FROM node:19-alpine3.17 as base
WORKDIR /app
RUN apk add --update --no-cache openssl
ARG TARGET_APP
ENV TARGET_APP $TARGET_APP
# Build target dependencies #
#############################
FROM base AS dependencies
# Yarn
RUN yarn set version berry
COPY package.json yarn.lock .yarnrc.yml ./
COPY schema.prisma .
COPY .yarn .yarn
RUN yarn workspaces focus --all --production
# Build target builder #
########################
FROM dependencies AS builder
COPY . .
RUN yarn
RUN yarn generate-schema
RUN yarn build-all --configuration=production
# Build target development #
############################
FROM builder AS development
CMD yarn dev
# Build target production #
###########################
FROM base AS production
ARG APP_VERSION=master
ENV APP_VERSION $APP_VERSION
COPY --from=builder /app/dist /app/dist
COPY --from=dependencies /app/node_modules /app/node_modules
COPY --from=builder /app/node_modules/.prisma /app/node_modules/.prisma
# Don't run as root
USER 1000:1001
# Start the app
CMD node /app/dist/apps/$TARGET_APP/main.js