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

Git repository discovery error in monorepo when using Docker #4195

Open
SimonVreman opened this issue Feb 11, 2025 · 1 comment
Open

Git repository discovery error in monorepo when using Docker #4195

SimonVreman opened this issue Feb 11, 2025 · 1 comment

Comments

@SimonVreman
Copy link

When building my project from the command line locally, just using pnpm next build, repository discovery happens as expected. However, when using Docker, I get a warning:

warn [nextra] Init git repository failed Discover git repo from [/app/docs] failed: could not find repository at '/app/docs'; class=Repository (6); code=NotFound (-3)

Project lives in a monorepo, with docs housing the Nextra app, first level subdirectory, running Nextra 4.2.7. Below is a Dockerfile I used to debug this, with git installed to confirm the repository is copied correctly (run container interactively with sh, run git status in build directory to confirm).

FROM node:20-alpine AS alpine
  RUN apk update
  RUN apk add --no-cache libc6-compat


FROM alpine AS base
  RUN npm install pnpm --global
  RUN pnpm config set store-dir ~/.pnpm-store


FROM base AS deps
  WORKDIR /app/docs
  COPY docs/package.json docs/pnpm-lock.yaml ./
  RUN pnpm i --frozen-lockfile


FROM base AS builder
  RUN apk add --no-cache git
  WORKDIR /app
  COPY .git .git

  WORKDIR /app/docs
  COPY --from=deps /app/docs/node_modules ./node_modules
  COPY ./docs .

  # Build the application
  ENV NEXT_TELEMETRY_DISABLED=1
  RUN pnpm build
@gmoigneu
Copy link

I have the same behavior using Upsun PaaS. Not sure what is causing this.

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

No branches or pull requests

2 participants