-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.58 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (39 loc) · 1.58 KB
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
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json tsconfig.base.json ./
COPY server/package.json server/package.json
COPY client/package.json client/package.json
COPY shared/package.json shared/package.json
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runtime
WORKDIR /app
LABEL org.opencontainers.image.source="https://github.com/ZengLiangYi/ChatCrystal"
LABEL org.opencontainers.image.description="ChatCrystal cloud server"
LABEL org.opencontainers.image.licenses="Apache-2.0"
ENV NODE_ENV=production
ENV PORT=3721
ENV DATA_DIR=/data
ENV CHATCRYSTAL_CLOUD_MODE=true
COPY package.json package-lock.json ./
COPY server/package.json server/package.json
COPY shared/package.json shared/package.json
RUN npm ci --omit=dev --workspace server --workspace shared --include-workspace-root=false --ignore-scripts \
&& npm cache clean --force
COPY --from=build /app/server/dist ./server/dist
COPY --from=build /app/client/dist ./client/dist
COPY --from=build /app/shared/types ./shared/types
COPY --from=build /app/README.md ./README.md
COPY --from=build /app/LICENSE ./LICENSE
COPY --from=build /app/NOTICE ./NOTICE
RUN chmod +x /app/server/dist/server/src/cli/index.js \
&& ln -s /app/server/dist/server/src/cli/index.js /usr/local/bin/crystal \
&& mkdir -p /data \
&& chown -R node:node /data
USER node
EXPOSE 3721
VOLUME ["/data"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:3721/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["npm", "start", "-w", "server"]