forked from wslyvh/useWeb3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
34 lines (27 loc) · 923 Bytes
/
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
FROM node:alpine3.15 as module-stage
WORKDIR /app
ENV NEXT_TELEMETRY_DEBUG=1
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add git
RUN which git
ENV PATH /app/node_modules/.bin:$PATH
ENV NODE_ENV production
COPY . /app
RUN yarn install --production --silent --ignore-optional --pure-lockfile
FROM module-stage as build-stage
WORKDIR /app
ENV NEXT_TELEMETRY_DEBUG=1
RUN yarn install --force && yarn run build && rm -rf .next/cache
FROM node:alpine3.15 as prod-stage
ENV NODE_ENV production
ENV PATH /app/node_modules/.bin:$PATH
WORKDIR /app
COPY --from=build-stage /app/.next /app/.next
COPY --from=module-stage /app/node_modules /app/node_modules
COPY . /app
RUN pm2 install pm2-logrotate \
&& pm2 set pm2-logrotate:max_size 10M \
&& pm2 set pm2-logrotate:retain 5 \
#RUN yarn cache clean --all
EXPOSE 80
ENTRYPOINT ["/bin/sh", "--", "./docker_entrypoint.sh"]