-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (60 loc) · 2.23 KB
/
Dockerfile
File metadata and controls
87 lines (60 loc) · 2.23 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM node:24-alpine AS ui-builder
WORKDIR /build
ENV CI=true
RUN corepack enable
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
COPY ui/package.json ./ui/
COPY server/package.json ./server/
RUN pnpm --filter @deepcrate/ui install --frozen-lockfile
COPY ui/ ./ui/
RUN pnpm --filter @deepcrate/ui run build
FROM node:24-alpine AS server-builder
WORKDIR /build
ENV CI=true
RUN corepack enable
# Build tools for Sequelize SQLite
RUN apk add --no-cache python3 make g++ sqlite-dev
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
COPY server/package.json ./server/
COPY ui/package.json ./ui/
RUN pnpm --filter @deepcrate/server install --frozen-lockfile
# Navigate into sqlite3's actual directory and build it manually
RUN cd /build/node_modules/.pnpm/sqlite3@5.1.7/node_modules/sqlite3 && \
npm run install && \
ls -la build/ && \
echo "SQLite3 build complete"
COPY server/src ./server/src
COPY server/tsconfig.json server/tsconfig.build.json ./server/
RUN pnpm --filter @deepcrate/server run build
FROM node:24-alpine AS production
ARG APP_VERSION=dev
WORKDIR /app
ENV CI=true
RUN corepack enable && apk add --no-cache curl su-exec
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
COPY server/package.json ./server/
COPY ui/package.json ./ui/
RUN pnpm --filter @deepcrate/server install --prod --frozen-lockfile --ignore-scripts
COPY --from=server-builder \
/build/node_modules/.pnpm/sqlite3@5.1.7/node_modules/sqlite3/build/ \
/app/node_modules/.pnpm/sqlite3@5.1.7/node_modules/sqlite3/build/
COPY --from=server-builder /build/server/dist ./server/dist
COPY --from=ui-builder /build/ui/dist ./static
ENV APP_VERSION=$APP_VERSION \
NODE_ENV=production \
CONFIG_PATH=/config/config.yaml \
DATA_PATH=/data \
LOG_LEVEL=info \
PORT=8080 \
HOST=0.0.0.0 \
LB_FETCH_INTERVAL=21600 \
CATALOG_INTERVAL=604800 \
SLSKD_INTERVAL=3600 \
RUN_JOBS_ON_STARTUP=true
RUN mkdir -p /data /config && chown node:node /data /config
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
COPY --chmod=755 docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "server/dist/server.js"]