-
Notifications
You must be signed in to change notification settings - Fork 26
/
Dockerfile
71 lines (51 loc) · 1.24 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
###################
# DEPENDENCIES
###################
FROM node:16-alpine As dependencies
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN apk add --update --no-cache \
make \
g++ \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev \
libtool \
autoconf \
automake
RUN npm install
USER node
###################
# BUILD
###################
FROM node:16-alpine As build
WORKDIR /usr/src/app
COPY --chown=node:node --from=dependencies /usr/src/app/node_modules ./node_modules
COPY --chown=node:node package*.json ./
COPY --chown=node:node src ./src
COPY --chown=node:node public ./public
COPY --chown=node:node tsconfig.json ./tsconfig.json
RUN apk add --update --no-cache \
make \
g++ \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev \
libtool \
autoconf \
automake
RUN npm run build
RUN npm install --omit=dev
USER node
###################
# PRODUCTION
###################
FROM node:16-alpine As production
WORKDIR /usr/src/app
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/build ./build
COPY --chown=node:node server.js ./server.js
RUN apk add --no-cache bash
CMD ["node", "server.js"]