Title: Does not work in Docker container based on node:slim · Issue #1986 · nodegit/nodegit · GitHub
Open Graph Title: Does not work in Docker container based on node:slim · Issue #1986 · nodegit/nodegit
X Title: Does not work in Docker container based on node:slim · Issue #1986 · nodegit/nodegit
Description: System information These are about the container. node version: ENV NODE_VERSION=20.5.1 npm or yarn version: 9.8.1 OS/version/architecture: debian12 Applicable nodegit version: 0.27.0 Trying to use nodegit with SvelteKit. With e.g. the f...
Open Graph Description: System information These are about the container. node version: ENV NODE_VERSION=20.5.1 npm or yarn version: 9.8.1 OS/version/architecture: debian12 Applicable nodegit version: 0.27.0 Trying to use...
X Description: System information These are about the container. node version: ENV NODE_VERSION=20.5.1 npm or yarn version: 9.8.1 OS/version/architecture: debian12 Applicable nodegit version: 0.27.0 Trying to use...
Opengraph URL: https://github.com/nodegit/nodegit/issues/1986
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Does not work in Docker container based on node:slim","articleBody":"## System information\r\nThese are about the container.\r\n - node version: ENV NODE_VERSION=20.5.1\r\n - npm or yarn version: 9.8.1\r\n - OS/version/architecture: debian12\r\n - Applicable nodegit version: 0.27.0\r\n\r\nTrying to use nodegit with SvelteKit.\r\nWith e.g. the following function, dev build works perfectly fine.\r\n\r\n```\r\nexport const addAndCommit = async (file: string, message: string) => {\r\n\tconsole.log(Git.version);\r\n\tconst repo = await Git.Repository.open(DATA_PATH);\r\n\tconst index = await repo.refreshIndex();\r\n\tconst result = await index.addByPath(file);\r\n\tif (result === 0) {\r\n\t\tthrow Error(`Cannot add to index: ${file}`);\r\n\t}\r\n\tawait index.write();\r\n\r\n\tconst changes = await index.writeTree();\r\n\tconst head = await Git.Reference.nameToId(repo, 'HEAD');\r\n\tconst parent = await repo.getCommit(head);\r\n\tconst author = generateAuthor();\r\n\tawait repo.createCommit('HEAD', author, author, message, changes, [parent]);\r\n};\r\n```\r\n\r\nFor production I containerized with this Dockerfile -\r\n\r\n```\r\nFROM node:slim\r\n\r\nWORKDIR /app\r\n\r\nCOPY . .\r\nRUN RUN apt-get install -y python3 libkrb5-dev gcc openssl libssh2-1-dev g++ make\r\nRUN npm ci\r\nRUN npm run build\r\n\r\nENV NODE_ENV=production\r\nEXPOSE 3000\r\nCMD [\"node\", \"build/index.js\"]\r\n\r\n```\r\n\r\nand all commands succeeded, including `npm ci`. But cannot read the Git repository, receiving this error message.\r\n\r\n```\r\n\"err\":{\"type\":\"TypeError\",\"message\":\"Cannot read properties of undefined (reading 'open')\",\"stack\":\"TypeError: Cannot read properties of undefined (reading 'open')\\n at addAndCommit (file:///carbon/build/server/chunks/git-7c944c50.js:6:37)\\n at POST (file:///carbon/build/server/chunks/_server.ts-8d43896a.js:47:15)\\n at async render_endpoint (file:///carbon/build/server/index.js:1570:20)\\n at async resolve (file:///carbon/build/server/index.js:3942:22)\\n at async respond (file:///carbon/build/server/index.js:3831:22)\\n at async Array.ssr (file:///carbon/build/handler.js:1221:3)\"}\r\n```\r\n\r\nI may miss some packages to make nodegit work inside docker container, but since we do not have any official documentation about including this library in the container I'm not sure.\r\n\r\nDoes anyone make it in a docker container?\r\n","author":{"url":"https://github.com/kyoheiu","@type":"Person","name":"kyoheiu"},"datePublished":"2023-09-01T20:30:22Z","url":"https://github.com/nodegit/nodegit/issues/1986"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bbec8eac-3e20-e1ab-587f-7dbb6914a2be |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA5E:86C7D:23EDC0:340088:6AFD7829 |
| html-safe-nonce | 533664363056c6db7ee0c4bd0333b43b25e3bde3006c5c1dc5eb135b7d7aea13 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTVFOjg2QzdEOjIzRURDMDozNDAwODg6NkFGRDc4MjkiLCJ2aXNpdG9yX2lkIjoiMTA2MDQ5NTUxMDk5ODk3MjQ1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 80ca9eb1b3fc6b6fc45a0e5d87f3dcafb2e9b52b95f84f82fddd24c5d65ee402 |
| hovercard-subject-tag | issue:1878012488 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodegit/nodegit/1986/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be8dab5e07d5ff9b610216009efbe0870f3f6eaa3a36f9e45c223d188188385a/nodegit/nodegit/issues/1986 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be8dab5e07d5ff9b610216009efbe0870f3f6eaa3a36f9e45c223d188188385a/nodegit/nodegit/issues/1986 |
| og:image:alt | System information These are about the container. node version: ENV NODE_VERSION=20.5.1 npm or yarn version: 9.8.1 OS/version/architecture: debian12 Applicable nodegit version: 0.27.0 Trying to use... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kyoheiu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 544ff6b59bd215c4609120f6e334dbd0b00d34fb6f8bc03a476f72256998887e |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 71c92f8b27ec5e9aa6f6477b4e067a4727fc9edb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width