-
Notifications
You must be signed in to change notification settings - Fork 31
/
Dockerfile
89 lines (60 loc) · 1.81 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
### BASE
FROM docker.intern.sparebank1.no/ubi8-nodejs18/master:latest as base
WORKDIR /app
RUN node -v
RUN npm -v
COPY portalen/cacert.pem .
RUN npm config set cafile /app/cacert.pem
ENV NODE_EXTRA_CA_CERTS=/app/cacert.pem
COPY portalen/package.json .
RUN npm install -g corepack
# Version of pnpm controlled via package.json#packageManager
RUN corepack enable
RUN corepack prepare --activate
### DEPENDENCIES
FROM base as dependencies
WORKDIR /app
COPY portalen/pnpm-lock.yaml .
COPY portalen/pnpm-workspace.yaml .
COPY portalen/.npmrc .
# Recreate minimal monorepo structure to install dependencies
# but not break Docker cache w/ changes in source code.
RUN mkdir -p apps/cms
RUN mkdir -p apps/server/public/fonts
RUN mkdir -p apps/server/public/types
RUN mkdir -p apps/web/app/data
RUN mkdir -p utils
RUN mkdir -p packages/shared
RUN mkdir -p packages/ui
RUN mkdir -p packages/jokul
RUN mkdir patches
COPY portalen/apps/cms/package.json apps/cms/package.json
COPY portalen/apps/server/package.json apps/server/package.json
COPY portalen/apps/web/package.json apps/web/package.json
COPY portalen/apps/server/postinstall.js apps/server/postinstall.js
COPY portalen/apps/web/tsconfig.types.json apps/web/tsconfig.types.json
COPY portalen/packages/shared/package.json packages/shared/package.json
COPY portalen/packages/ui/package.json packages/ui/package.json
COPY tsconfig.json .
COPY packages/jokul packages/jokul
COPY utils utils
COPY portalen/patches/* patches/
WORKDIR /app/packages/jokul
RUN pnpm install
RUN pnpm build
WORKDIR /app
RUN pnpm install
### BUILDER
FROM dependencies as build
WORKDIR /app
COPY portalen/apps/ apps/
COPY portalen/packages/ packages/
COPY portalen/tsconfig.json .
COPY portalen/turbo.json .
RUN pnpm build
### OUTPUT
FROM build as output
WORKDIR /app
RUN ls -al
EXPOSE 3000
CMD pnpm serve