Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run docker container #1308

Closed
heinsenberg82 opened this issue Dec 27, 2024 · 1 comment
Closed

Can't run docker container #1308

heinsenberg82 opened this issue Dec 27, 2024 · 1 comment

Comments

@heinsenberg82
Copy link

This is my dockerfile:

FROM node:23
RUN apt-get update && apt-get install -y build-essential libnode108 nodejs python3 sqlite3 libsqlite3-dev make node-gyp g++ && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package*.json ./
ENV NODE_ENV=production
RUN npm install --omit=dev && npm cache clean --force
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]

The container starts and soon exits with this error:

SQLite: Error: libnode.so.72: cannot open shared object file: No such file or directory

    at Object..node (node:internal/modules/cjs/loader:1931:18)
    at Module.load (node:internal/modules/cjs/loader:1474:32)
    at Function._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
    at Module.require (node:internal/modules/cjs/loader:1496:12)
    at require (node:internal/modules/helpers:135:16)
    at bindings (/app/node_modules/bindings/bindings.js:112:48)
    at new Database (/app/node_modules/better-sqlite3/lib/database.js:48:64)
    at Object.<anonymous> (/app/index.js:16:8) {
  code: 'ERR_DLOPEN_FAILED'
}

I've already tried to install this libnode.so.72 library, but no package manager I tried could find it.

I know the error happens here:

const Database = require('better-sqlite3');
db = new Database('database.db', { verbose: console.log}); // <-- can't pass this line

Any help will be appreciated, also some dockerfile template would be nice.

@heinsenberg82
Copy link
Author

Never mind. Just had to put a .dockerignore file on the root of the project pointing to node_modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant