fix(nx/docker): wrong native for better-sqlite3

This commit is contained in:
Elian Doran 2025-04-25 12:15:02 +03:00
parent 9ef24eff52
commit a808f0680c
No known key found for this signature in database
3 changed files with 69 additions and 61 deletions

View File

@ -1,17 +1,23 @@
FROM node:22.14.0-alpine AS builder
RUN corepack enable
# Install native dependencies since we might be building cross-platform.
WORKDIR /usr/src/app
COPY /apps/server/dist /apps/server/pnpm-workspace.yaml /usr/src/app/
RUN rm -r node_modules/better-sqlite3 && pnpm install --frozen-lockfile --prod && pnpm rebuild
FROM node:22.14.0-alpine FROM node:22.14.0-alpine
# Install runtime dependencies
RUN apk add --no-cache su-exec shadow
# Install runtime dependencies WORKDIR /usr/src/app
RUN apk add --no-cache su-exec shadow COPY --from=builder /usr/src/app /usr/src/app
COPY /apps/server/start-docker.sh /usr/src/app
WORKDIR /usr/src/app # Add application user
RUN adduser -s /bin/false node; exit 0
COPY /apps/server/dist /usr/src/app # Configure container
COPY /apps/server/start-docker.sh /usr/src/app EXPOSE 8080
CMD [ "sh", "./start-docker.sh" ]
# Add application user HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
RUN adduser -s /bin/false node; exit 0
# Configure container
EXPOSE 8080
CMD [ "sh", "./start-docker.sh" ]
HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js

View File

@ -2,7 +2,53 @@
"name": "@triliumnext/server", "name": "@triliumnext/server",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"dependencies": { "dependencies": {
"better-sqlite3": "11.9.1"
},
"devDependencies": {
"@electron/remote": "2.1.2",
"@excalidraw/excalidraw": "0.18.0",
"@highlightjs/cdn-assets": "11.11.1",
"@types/archiver": "6.0.3",
"@types/better-sqlite3": "7.6.13",
"@types/cheerio": "0.22.35",
"@types/cls-hooked": "4.3.9",
"@types/compression": "1.7.5",
"@types/cookie-parser": "1.4.8",
"@types/debounce": "1.2.4",
"@types/ejs": "3.1.5",
"@types/escape-html": "1.0.4",
"@types/express-http-proxy": "1.6.6",
"@types/express-session": "1.18.1",
"@types/fs-extra": "11.0.4",
"@types/html": "1.0.4",
"@types/ini": "4.1.1",
"@types/js-yaml": "4.0.9",
"@types/jsdom": "21.1.7",
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/safe-compare": "1.1.2",
"@types/sanitize-html": "2.15.0",
"@types/sax": "1.2.7",
"@types/serve-favicon": "2.5.7",
"@types/serve-static": "1.15.7",
"@types/session-file-store": "1.2.5",
"@types/stream-throttle": "0.1.4",
"@types/supertest": "6.0.3",
"@types/swagger-ui-express": "4.1.8",
"@types/tmp": "0.2.6",
"@types/turndown": "5.0.5",
"@types/ws": "8.18.1",
"@types/xml2js": "0.4.14",
"autocomplete.js": "0.38.1",
"boxicons": "2.1.4",
"codemirror": "5.65.19",
"express-http-proxy": "2.1.1",
"jquery": "3.7.1",
"jquery-hotkeys": "0.2.2",
"jquery.fancytree": "2.38.5",
"katex": "0.16.22",
"normalize.css": "8.0.1",
"@anthropic-ai/sdk": "0.39.0", "@anthropic-ai/sdk": "0.39.0",
"@braintree/sanitize-url": "7.1.1", "@braintree/sanitize-url": "7.1.1",
"@triliumnext/commons": "workspace:*", "@triliumnext/commons": "workspace:*",
@ -11,7 +57,6 @@
"archiver": "7.0.1", "archiver": "7.0.1",
"async-mutex": "0.5.0", "async-mutex": "0.5.0",
"axios": "1.8.4", "axios": "1.8.4",
"better-sqlite3": "11.9.1",
"bindings": "1.5.0", "bindings": "1.5.0",
"chardet": "2.1.0", "chardet": "2.1.0",
"cheerio": "1.0.0", "cheerio": "1.0.0",
@ -76,52 +121,6 @@
"xml2js": "0.6.2", "xml2js": "0.6.2",
"yauzl": "3.2.0" "yauzl": "3.2.0"
}, },
"devDependencies": {
"@electron/remote": "2.1.2",
"@excalidraw/excalidraw": "0.18.0",
"@highlightjs/cdn-assets": "11.11.1",
"@types/archiver": "6.0.3",
"@types/better-sqlite3": "7.6.13",
"@types/cheerio": "0.22.35",
"@types/cls-hooked": "4.3.9",
"@types/compression": "1.7.5",
"@types/cookie-parser": "1.4.8",
"@types/debounce": "1.2.4",
"@types/ejs": "3.1.5",
"@types/escape-html": "1.0.4",
"@types/express-http-proxy": "1.6.6",
"@types/express-session": "1.18.1",
"@types/fs-extra": "11.0.4",
"@types/html": "1.0.4",
"@types/ini": "4.1.1",
"@types/js-yaml": "4.0.9",
"@types/jsdom": "21.1.7",
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/safe-compare": "1.1.2",
"@types/sanitize-html": "2.15.0",
"@types/sax": "1.2.7",
"@types/serve-favicon": "2.5.7",
"@types/serve-static": "1.15.7",
"@types/session-file-store": "1.2.5",
"@types/stream-throttle": "0.1.4",
"@types/supertest": "6.0.3",
"@types/swagger-ui-express": "4.1.8",
"@types/tmp": "0.2.6",
"@types/turndown": "5.0.5",
"@types/ws": "8.18.1",
"@types/xml2js": "0.4.14",
"autocomplete.js": "0.38.1",
"boxicons": "2.1.4",
"codemirror": "5.65.19",
"electron": "35.1.5",
"express-http-proxy": "2.1.1",
"jquery": "3.7.1",
"jquery-hotkeys": "0.2.2",
"jquery.fancytree": "2.38.5",
"katex": "0.16.22",
"normalize.css": "8.0.1"
},
"nx": { "nx": {
"targets": { "targets": {
"serve": { "serve": {

View File

@ -0,0 +1,3 @@
nodeLinker: isolated
onlyBuiltDependencies:
- better-sqlite3