forked from nteract/commuter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (57 loc) · 1.42 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
##################################
# Build
##################################
FROM node:14 as build
RUN mkdir -p /opt/build
WORKDIR /opt/build
COPY ./src ./src
COPY [ \
"babel.config.js", \
"next.config.js", \
"package.json", \
"yarn.lock", \
"./" \
]
RUN yarn install && \
yarn build
##################################
# Dependencies
##################################
FROM node:14 as dependencies
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get install --yes --no-install-recommends \
build-essential \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev && \
\
rm -rf /var/lib/apt/lists/*
ENV NODE_ENV='production'
RUN mkdir -p /opt/build
WORKDIR /opt/build
COPY --from=build [ \
"/opt/build/package.json", \
"/opt/build/yarn.lock", \
"./" \
]
RUN yarn install --production=true
##################################
# Release
##################################
FROM node:14-slim as release
# Install tini
ARG TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENV NODE_ENV='production'
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY --from=build /opt/build/.next /opt/app/.next
COPY --from=build /opt/build/lib /opt/app/lib
COPY --from=dependencies /opt/build/node_modules /opt/app/node_modules
COPY ./public /opt/app/public
ENTRYPOINT ["/tini", "-g", "--"]
CMD [ "node", "lib/index.js" ]