-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdockerfile.node
More file actions
82 lines (63 loc) · 2.6 KB
/
dockerfile.node
File metadata and controls
82 lines (63 loc) · 2.6 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
# Build stage: full install + compile (Node.js for Synology/legacy kernel compatibility)
FROM node:24.14.1-alpine@sha256:01743339035a5c3c11a373cd7c83aeab6ed1457b55da6a69e014a95ac4e4700b AS builder
WORKDIR /app
ARG TMDBAPIKEY
ENV tmdbApiKey=${TMDBAPIKEY}
# Transform package.json for Node.js:
# - Replace bun:sqlite shim with real better-sqlite3
# - Add tsx for running TypeScript migrations at runtime
# - Replace bun commands with npm/node equivalents
COPY package.json ./package.json.bak
RUN cat package.json.bak \
| sed 's|"file:packages/better-sqlite3-bun"|"12.8.0"|' \
| sed '/"better-sqlite3":/a\ "tsx": "^4.21.0",' \
| sed 's|bun run build:server|npm run build:server|g' \
| sed 's|bun run clean:client|npm run clean:client|g' \
| sed 's|bun run --bun vite build|vite build|g' \
| sed 's|bun run --bun|npx tsx|g' \
> package.json
RUN --mount=type=cache,target=/root/.npm \
HUSKY=0 npm install
COPY vite.config.js tsconfig.json postcss.config.mjs ./
COPY src ./src
RUN --mount=type=cache,target=/app/node_modules/.vite \
npm run build
# Prune to production deps only (tsx included via package.json transform)
RUN npm prune --omit=dev && \
rm -rf node_modules/vite node_modules/rollup \
node_modules/@rollup \
node_modules/rolldown node_modules/@rolldown
# Final runtime image
FROM node:24.14.1-alpine@sha256:01743339035a5c3c11a373cd7c83aeab6ed1457b55da6a69e014a95ac4e4700b
WORKDIR /app
# tini for proper PID 1 zombie reaping, wget for healthcheck, su-exec for privilege drop
RUN apk add --no-cache tini wget su-exec
# Remove node user from base image (occupies UID 1000) and create pulsarr user
RUN deluser --remove-home node && \
delgroup node; \
addgroup -g 1000 -S pulsarr && \
adduser -u 1000 -G pulsarr -D -H -s /sbin/nologin pulsarr
COPY package.json ./
COPY --from=builder /app/node_modules ./node_modules
RUN mkdir -p /app/data/db && \
mkdir -p /app/data/logs && \
chown -R pulsarr:pulsarr /app/data
COPY --from=builder /app/dist ./dist
COPY migrations ./migrations
COPY docker-entrypoint.node.sh ./docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh
COPY docker-healthcheck.sh ./
RUN chmod +x docker-healthcheck.sh
# Copy license and documentation files for compliance
COPY LICENSE* ./
COPY README.md ./
# Pass TMDB API key to runtime (GitHub Actions converts to TMDBAPIKEY)
ARG TMDBAPIKEY
ENV NODE_ENV=production
ENV tmdbApiKey=${TMDBAPIKEY}
VOLUME ["/app/data"]
EXPOSE 3003
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD ./docker-healthcheck.sh
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["./docker-entrypoint.sh"]