-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
114 lines (73 loc) · 2.48 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
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
# ==== COMMON
FROM node:18.18.2-alpine3.18 AS base
LABEL maintainer="ezTeam <ezteam@couperin.org>"
ENV HUSKY=0
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# Update APK registry
RUN apk update \
&& apk upgrade -U -a
RUN corepack enable
# ==== PNPM
FROM base AS pnpm
WORKDIR /usr/build
# Install node-canvas build dependencies
# see https://github.com/Automattic/node-canvas/issues/866
RUN apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev
COPY ./package.json ./pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY . .
# ==== REPORT
FROM pnpm AS report-prisma
RUN pnpm deploy --filter ezreeport-report ./report-dev
WORKDIR /usr/build/report-dev
# Install prisma dependencies
RUN apk add --no-cache --update python3 \
&& ln -sf python3 /usr/bin/python
# Generate prisma-client
RUN npx prisma generate
# ---
FROM pnpm AS report-pnpm
RUN pnpm deploy --filter ezreeport-report --prod ./report
# ---
FROM base AS report
EXPOSE 8080
ENV NODE_ENV=production
WORKDIR /usr/build/report
# Install node-canvas dependencies
RUN apk add --no-cache cairo jpeg pango giflib
COPY --from=report-pnpm /usr/build/report .
COPY --from=report-prisma /usr/build/report-dev/.prisma ./.prisma
HEALTHCHECK --interval=1m --timeout=10s --retries=5 --start-period=20s \
CMD wget -Y off --no-verbose --tries=1 --spider http://localhost:8080/health/ezreeport-report || exit 1
CMD [ "npm", "run", "start" ]
# ==== MAIL
FROM pnpm AS mail-pnpm
RUN pnpm deploy --filter ezreeport-mail --prod ./mail
# ---
FROM base AS mail
EXPOSE 8080
ENV NODE_ENV=production
WORKDIR /usr/build/mail
COPY --from=mail-pnpm /usr/build/mail .
HEALTHCHECK --interval=1m --timeout=10s --retries=5 --start-period=20s \
CMD wget -Y off --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
CMD [ "npm", "run", "start" ]
# ==== VUE DOC
FROM pnpm AS vuedoc-builder
RUN pnpm deploy --filter @ezpaarse-project/ezreeport-sdk-js --prod ./sdk
RUN pnpm deploy --filter @ezpaarse-project/ezreeport-vue ./vue
WORKDIR /usr/build/vue
ARG AUTH_TOKEN="changeme"
ARG REPORT_API="http://localhost:8080/"
ARG LOGO_URL="https://ezmesure.couperin.org/"
ENV VITE_AUTH_TOKEN=${AUTH_TOKEN} \
VITE_REPORT_API=${REPORT_API} \
VITE_NAMESPACES_LOGO_URL=${LOGO_URL}
RUN npm run build:docs
# ---
FROM nginx:stable-alpine AS vuedoc
WORKDIR /usr/share/nginx/html
COPY ./config/vue-ngnix.types /etc/nginx/mime.types
COPY --from=vuedoc-builder /usr/build/vue/storybook-static ./
EXPOSE 80