-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathDockerfile
63 lines (48 loc) · 2.17 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
FROM node:20-slim as builder
LABEL maintainer="Kagurazaka Mizuki"
WORKDIR /app
COPY . /app
ENV IS_DOCKER=true
ARG USE_CHINA_MIRROR=0
RUN if [ "$USE_CHINA_MIRROR" = 1 ]; then \
sed -i 's/http:\/\/.*\.debian.org/http:\/\/mirrors.cloud.tencent.com/g' /etc/apt/sources.list \
&& npm config set registry https://mirrors.cloud.tencent.com/npm/ \
&& npm config set PRISMA_BINARIES_MIRROR https://r.cnpmjs.org/-/binary/prisma; \
fi;\
apt-get -y update \
&& apt-get install -y git python3 apt-transport-https ca-certificates build-essential \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& npm install pnpm -g \
&& pnpm install --unsafe-perm \
&& pnpm build
FROM node:20-alpine as app
WORKDIR /app
COPY --from=0 /app/package.json ./
COPY --from=0 /app/.npmrc ./
COPY --from=0 /app/LICENSE ./
COPY --from=0 /app/pnpm-lock.yaml ./
COPY --from=0 /app/pnpm-workspace.yaml ./
COPY --from=0 /app/packages/nodestatus-cli/package.json ./packages/nodestatus-cli/
COPY --from=0 /app/packages/nodestatus-server/package.json ./packages/nodestatus-server/
COPY --from=0 /app/packages/nodestatus-server/build ./packages/nodestatus-server/build
COPY --from=0 /app/packages/nodestatus-server/scripts ./packages/nodestatus-server/scripts
COPY --from=0 /app/packages/nodestatus-server/prisma ./packages/nodestatus-server/prisma
COPY --from=0 /app/web/classic-theme/package.json ./web/classic-theme/
COPY --from=0 /app/web/hotaru-theme/package.json ./web/hotaru-theme/
COPY --from=0 /app/web/hotaru-admin/package.json ./web/hotaru-admin/
COPY --from=0 /app/web/utils/package.json ./web/utils/
ENV IS_DOCKER=true
ENV NODE_ENV=production
ARG USE_CHINA_MIRROR=0
RUN if [ "$USE_CHINA_MIRROR" = 1 ]; then \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.cloud.tencent.com/g' /etc/apk/repositories \
&& npm config set registry https://mirrors.cloud.tencent.com/npm/ \
&& npm config set PRISMA_BINARIES_MIRROR https://r.cnpmjs.org/-/binary/prisma; \
fi;\
apk add --no-cache --virtual .build-deps git make gcc g++ python3 \
&& npm install pm2 pnpm -g \
&& pnpm install --prod --frozen-lockfile \
&& npm cache clean --force \
&& apk del .build-deps
EXPOSE 35601
CMD ["pm2-runtime", "start", "npm" , "--", "start"]