-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to node from bun and use pnpm for package management. #19
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cbc3de5
Initial plan
Copilot 9a452c3
Switch Docker install to pnpm
Copilot 531552d
Switch Docker build to pnpm to avoid Bun registry 404s
Copilot 8248b5c
Rollback to pnpm.
Coderx85 d885458
Merge branch 'copilot/fix-docker-build-bun-errors' into migrate/pnpm.
Coderx85 b6594e4
install remaining dependencies.
Coderx85 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,4 +19,3 @@ dist | |
| build | ||
| .turbo | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,58 @@ | ||
| FROM oven/bun:1.2-debian AS base | ||
| WORKDIR /app | ||
| FROM node:23-alpine AS base | ||
|
|
||
| FROM base AS install | ||
| RUN mkdir -p /temp/dev | ||
| COPY package.json bun.lock /temp/dev/ | ||
| RUN cd /temp/dev && bun install --frozen-lockfile | ||
| # Required for some native modules on Alpine | ||
| RUN apk add --no-cache libc6-compat | ||
|
|
||
| # install with --production (exclude devDependencies) | ||
| RUN mkdir -p /temp/prod | ||
| COPY package.json bun.lock /temp/prod/ | ||
| RUN cd /temp/prod && bun install --frozen-lockfile --production | ||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| RUN corepack enable | ||
| WORKDIR /app | ||
| ENV NODE_ENV=production | ||
| ENV NPM_CONFIG_REGISTRY=https://registry.npmjs.org/ | ||
| RUN corepack enable && corepack prepare pnpm@9.15.4 --activate | ||
|
|
||
| FROM base AS prerelease | ||
| COPY --from=install /temp/dev/node_modules node_modules | ||
| COPY . . | ||
| FROM base AS deps | ||
| ENV HUSKY=0 | ||
| ENV SKIP_HUSKY=1 | ||
|
|
||
| # Use Node.js for build (Bun has compatibility issues with Next.js 16 Turbopack) | ||
| FROM node:20-slim AS build | ||
| # Copy package files only to cache deps layer | ||
| COPY package.json pnpm-lock.yaml .npmrc* ./ | ||
| RUN corepack enable pnpm && pnpm install --frozen-lockfile | ||
Coderx85 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FROM base AS builder | ||
| WORKDIR /app | ||
| COPY --from=prerelease /app ./ | ||
| COPY --from=deps /app/node_modules ./node_modules | ||
| COPY . . | ||
| # Ensure standalone output is generated | ||
| ENV NEXT_PRIVATE_STANDALONE=true | ||
Coderx85 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ARG NEXT_PUBLIC_APP_URL | ||
| ARG DATABASE_URL | ||
| ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL | ||
| ENV DATABASE_URL=$DATABASE_URL | ||
| RUN npm run build | ||
| RUN corepack enable pnpm && pnpm run build | ||
Coderx85 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FROM base AS release | ||
| FROM node:23-alpine AS runner | ||
| WORKDIR /app | ||
| COPY --from=install /temp/prod/node_modules node_modules | ||
| COPY --from=build /app/.next/standalone ./ | ||
| COPY --from=build /app/.next/static ./.next/static/ | ||
| COPY --from=build /app/public ./public | ||
| ENV NODE_ENV=production | ||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
|
||
| # Create non-root user | ||
| RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs | ||
|
|
||
| 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 | ||
|
|
||
| # Fix permissions: remove write where not needed and add execute where required | ||
| # Ensure .next cache exists and is owned by nextjs so server can write runtime cache | ||
| RUN mkdir -p .next/cache && \ | ||
| chown -R nextjs:nodejs .next /app && \ | ||
| chmod -R u+rwX .next && chmod -R u+rwX .next/cache && \ | ||
| chmod -R a-w+x . && chmod -R a+x .next node_modules | ||
Coderx85 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| USER nextjs | ||
|
|
||
| EXPOSE 3000 | ||
| ENV PORT=3000 | ||
| ENV HOSTNAME="localhost" | ||
| ENV NETWORK="0.0.0.0" | ||
| CMD ["bun", "server.js"] | ||
| ENV HOSTNAME="0.0.0.0" | ||
| CMD ["node", "server.js"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.