-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (36 loc) · 1.1 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
# -----------------------
# ---- Base stage -------
# -----------------------
FROM mhart/alpine-node:12.14.1 AS base
# set working directory
WORKDIR /root/app
# copy app sources
COPY . .
# -----------------------
# ---- build Stage ------
# -----------------------
FROM base AS build
# install node packages
RUN npm set progress=false && npm config set depth 0
# install global packages
#RUN npm install -g typescript
# install only production node_modules
RUN npm ci --only=production
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm ci
# build the production application in the .next folder
RUN npm run build
# -----------------------
# ---- Release Stage ----
# -----------------------
FROM base AS release
# copy production node_modules
COPY --from=build /root/app/prod_node_modules ./node_modules
COPY --from=build /root/app/.next ./.next
# expose port and define CMD
EXPOSE 3000
# start a Node.js server that supports hybrid pages
# serving both statically generated and server-side rendered pages
CMD npm run start