diff --git a/Dockerfile b/Dockerfile index 0440879..f668e47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,13 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" # 1. Install dependencies only when needed FROM base AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. -RUN apk add --no-cache libc6-compat +RUN apk add --no-cache libc6-compat git WORKDIR /app +# Initialize git repository to prevent Nextra warnings +RUN git init + # Install dependencies based on the preferred package manager COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ RUN \ @@ -27,6 +30,8 @@ FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . +# Initialize git repository in builder stage as well +RUN git init # This will do the trick, use the corresponding env file for each environment. # COPY .env.production.sample .env.production RUN npm run build @@ -47,6 +52,10 @@ COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +# Initialize git repository in production stage +RUN apk add --no-cache git && \ + git init && \ + chown -R nextjs:nodejs .git USER nextjs