-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
65 lines (45 loc) · 1.27 KB
/
dockerfile
File metadata and controls
65 lines (45 loc) · 1.27 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM node:16-alpine as prod-lib-builder
# Build types
COPY package.json .
COPY types types
RUN yarn --cwd types install
RUN yarn --cwd types build
# Get libs needed at runtime by prod
COPY server/package.json server/package.json
RUN NODE_ENV=production yarn add-types:server
FROM node:16-alpine as server-builder
RUN npm install -g typescript
# Build types
COPY package.json .
COPY types types
RUN yarn --cwd types install
RUN yarn --cwd types build
# Install dependencies
COPY server/package.json server/package.json
RUN yarn add-types:server
# Build the server
COPY server server
RUN yarn --cwd server build
FROM node:16-alpine as client-builder
# Build types
COPY package.json .
COPY types types
RUN yarn --cwd types install
RUN yarn --cwd types build
# Install dependencies
COPY client/package.json client/package.json
RUN yarn add-types:client
# Build the client
COPY client client
RUN yarn --cwd client build
FROM node:16-alpine
# Install a static server and tools
RUN npm install -g serve concurrently
WORKDIR /usr/src/app
# Copy the server app
COPY --from=prod-lib-builder server/node_modules node_modules
COPY --from=server-builder server/dist dist
# Copy the frontend app
COPY --from=client-builder client/build dist/build
EXPOSE 3000
CMD [ "node", "dist/index.js" ]