Open
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 following function, dev build works perfectly fine.
export const addAndCommit = async (file: string, message: string) => {
console.log(Git.version);
const repo = await Git.Repository.open(DATA_PATH);
const index = await repo.refreshIndex();
const result = await index.addByPath(file);
if (result === 0) {
throw Error(`Cannot add to index: ${file}`);
}
await index.write();
const changes = await index.writeTree();
const head = await Git.Reference.nameToId(repo, 'HEAD');
const parent = await repo.getCommit(head);
const author = generateAuthor();
await repo.createCommit('HEAD', author, author, message, changes, [parent]);
};
For production I containerized with this Dockerfile -
FROM node:slim
WORKDIR /app
COPY . .
RUN RUN apt-get install -y python3 libkrb5-dev gcc openssl libssh2-1-dev g++ make
RUN npm ci
RUN npm run build
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "build/index.js"]
and all commands succeeded, including npm ci
. But cannot read the Git repository, receiving this error message.
"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)"}
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?
Metadata
Metadata
Assignees
Labels
No labels