Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

Docker builds failed on bun install --frozen-lockfile with 404s for some npm packages during image creation.

  • Build toolchain: Replace Bun-based install stages with pnpm on Node 20, pin npm registry, and enable corepack for pnpm. Runtime now executes node server.js.
  • Dependencies: Add pnpm-lock.yaml, include framer-motion and @types/pg to satisfy TypeScript checks. Update .dockerignore to skip pnpm store artifacts.

Example (install stage):

FROM node:20-slim AS install
WORKDIR /temp/dev
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
RUN pnpm install --frozen-lockfile
Original prompt

I am building a Docker image for a Next.js project using Bun, but the build fails at bun install --frozen-lockfile due to 404 errors fetching some npm packages.
Please search for solutions to this error, including alternative Bun install flags or registry settings.
Use internet search to find fixes for Bun 404 errors during Docker builds.
If no Bun solution works, update the Dockerfile to use pnpm instead of Bun for installing dependencies.
Make sure the .dockerignore and Dockerfile are updated accordingly.

Issue - I am building a Docker image for a Next.js project using Bun, but the build fails at bun install --frozen-lockfile due to 404 errors fetching some npm packages.
Please search for solutions to this error, including alternative Bun install flags or registry settings.
Use internet search to find fixes for Bun 404 errors during Docker builds.
If no Bun solution works, update the Dockerfile to use pnpm instead of Bun for installing dependencies.
Make sure the .dockerignore and Dockerfile are updated accordingly.

Issue -

 > [install 3/6] RUN cd /temp/dev && bun install --frozen-lockfile:        
0.174 bun install v1.2.23 (cf136713)                                       
21.07 error: GET https://registry.npmjs.org/@img/colour/-/colour-1.0.0.tgz - 404                                                                      
21.07 
21.07 error: GET https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz - 404
------
Dockerfile:7
--------------------
   5 |     RUN mkdir -p /temp/dev
   6 |     COPY package.json bun.lock /temp/dev/
   7 | >>> RUN cd /temp/dev && bun install --frozen-lockfile
   8 |     
   9 |     # install with --production (exclude devDependencies)
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c cd /temp/dev && bun install --frozen-lockfile" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/default/default/ifd91v5pqaahjbvgz8sox1asw

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 19, 2025
@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
collaro Ready Ready Preview Dec 19, 2025 6:52am

@Coderx85
Copy link
Owner

@copilot Start fixing it.

Copilot AI and others added 2 commits December 19, 2025 06:49
Co-authored-by: Coderx85 <97401895+Coderx85@users.noreply.github.com>
Co-authored-by: Coderx85 <97401895+Coderx85@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Docker image build errors for Next.js project Switch Docker build to pnpm to avoid Bun registry 404s Dec 19, 2025
Copilot AI requested a review from Coderx85 December 19, 2025 06:50
Copy link
Contributor Author

Copilot AI commented Dec 19, 2025

@copilot Start fixing it.

Addressed by switching Docker install to pnpm with registry pinning and updated runtime (commit 9a452c3). Let me know if you’d like any adjustments or a Bun-based workaround retained instead.

@Coderx85
Copy link
Owner

Merge to #19

@Coderx85 Coderx85 closed this Dec 28, 2025
@Coderx85 Coderx85 deleted the copilot/fix-docker-build-bun-errors branch December 28, 2025 13:36
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

Successfully merging this pull request may close these issues.

2 participants