-
Notifications
You must be signed in to change notification settings - Fork 695
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
Does not work in Docker container based on node:slim #1986
Comments
Seems to work with the latest alpha version ( Tested with this Dockerfile: FROM node:slim
WORKDIR /app
COPY . .
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y python3 libkrb5-dev gcc openssl libssh2-1-dev g++ make
RUN JOBS=max npm ci
ENV NODE_ENV=production
CMD ["node", "main.js"] (This installs with node v20.8.0 in the container.)
const Git = require("nodegit");
(async () => {
const repo = await Git.Repository.open("/path/to/git/repo");
const index = await repo.refreshIndex();
const status = await repo.getStatusExt();
console.log("Repo status:", status);
})();
{
"name": "nodegit-test",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"podman:build": "podman build . --tag nodegit-test",
"podman:run": "podman run -t nodegit-test"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"nodegit": "0.28.0-alpha.21"
}
} When executed in the docker container this throws an exception since the repository we try to open does not exist in the container:
But just tried with [email protected] and seems to work just fine, same error Also did a quick test with ESM modules (setting Could it be different node versions on the host and container resulting in slightly different module resolutions or something similar? Or try re-downloading the container (think it is I vaguely recall some similar behavior on MacOS (maybe?) where some functions where missing on the "Git" object (nodegit import). That might have been something with nodegit being built against a different version of openssl resulting in some things working and others didn't. But don̈́t quite remember.. Don't know if it can help somehow but if you execute console.dir(Git.__proto__, { depth: 1, showHidden: true, showProxy: true }); it should show:
somewhere in the output. |
Also just noticed nodegit can't be imported as import * as Git from "nodegit"; Then you get all the exports and functions on |
System information
These are about the container.
Trying to use nodegit with SvelteKit.
With e.g. the following function, dev build works perfectly fine.
For production I containerized with this Dockerfile -
and all commands succeeded, including
npm ci
. But cannot read the Git repository, receiving this error message.I 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.
Does anyone make it in a docker container?
The text was updated successfully, but these errors were encountered: