-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
134 lines (72 loc) · 2.86 KB
/
Dockerfile.dev
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
FROM alpine as grpc-probe
ARG TARGETARCH
COPY ./docker/get_grpc_probe.sh /get_grpc_probe.sh
RUN --mount=type=cache,target=/var/cache/apk apk add --update wget
RUN chmod +x ./get_grpc_probe.sh
RUN TARGETARCH=$TARGETARCH ./get_grpc_probe.sh
# TODO: Switch over to minimal node installation
FROM node:18 as deps
# pnpm needs to be added to the global path
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY . .
RUN --mount=type=cache,sharing=locked,target=/var/cache/apt apt update && apt install -y python3 make g++ protobuf-compiler
RUN chmod +x /app/packages/proto/gen_protos.sh
WORKDIR /app/packages/proto
RUN pnpm --filter juno-proto install --frozen-lockfile
RUN pnpm --filter juno-proto build
WORKDIR /app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install -r --frozen-lockfile --ignore-scripts
# TODO: Switch over to a minimal node installation
FROM node:18 as base-service
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY --from=grpc-probe /grpc_health_probe /bin/grpc_health_probe
RUN chmod a+x /bin/grpc_health_probe
FROM base-service as api-gateway-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/api-gateway/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/api-gateway
FROM base-service as auth-service-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/auth-service/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/auth-service
FROM base-service as email-service-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/email-service/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/email-service
FROM base-service as file-service-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/file-service/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/file-service
FROM base-service as logging-service-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/logging-service/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/logging-service
FROM base-service as db-service-dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules/
COPY --from=deps /app/packages/db-service/node_modules ./packages/node_modules/
COPY . .
COPY --from=deps /app/packages/proto/ ./packages/proto/
WORKDIR /app/packages/db-service
RUN echo $(ls -a -1 /app/node_modules)
RUN pnpm prisma generate