package-lock.json not found for checksum calculation

I see that Fly.io supports deploying Bun apps. However if no package-lock.json is present I get this error:

Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref obtk9ao2dsangeut5jjbrxu7w::nki4lb1sbgtiwiltyvpswp5ej: "/package-lock.json": not found

It seems like Fly should be able to use bun.lockb for this effect, no?

Best,
David

What matters here is the Dockerfile. Can you tell me more how it was produced? Did it exist prior to fly launch or did we create it? If the latter, was there a bun.lockb file present at the time?

Newer versions of bun create a bun.lock file instead. An example Dockerfile we produce when we detect the presence of this file:

This Dockerfile was created by fly launch, and unfortunately I don’t have it anymore :frowning:

However, I can confidently say there was a bun.lockb in the directory when I ran fly launch.

Anyway, if you already support bun.lock I think that’s good enough and you can close this topic. I just upgraded Bun and verified this works.

Hi! im currently going through the same problem!
This same dockerfile worked in previous bun versions (i.e. ARG BUN_VERSION=1.1.34 FROM oven/bun:${BUN_VERSION}-slim as base)

This is my current docker file:

# syntax = docker/dockerfile:1

# Adjust BUN_VERSION as desired
# ARG BUN_VERSION=1.1.34
FROM oven/bun:latest as base

LABEL fly_launch_runtime="Nuxt"

# Nuxt app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3

# Install node modules
COPY bun.lockb package.json ./
RUN bun install

# Copy application code
COPY . .

# Build application
RUN bun --bun run build

# Remove development dependencies
RUN rm -rf node_modules && \
    bun install --ci


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
ENV HOST=0
CMD [ "node", ".output/server/index.mjs" ]

After trying with a couple of iterations the error is persistent:

=> CANCELED [base 2/2] WORKDIR /app                                                                                                          0.0s
 => CACHED [build 1/6] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3  0.0s
 => ERROR [build 2/6] COPY bun.lockb package.json ./                                                                                          0.0s
------
 > [build 2/6] COPY bun.lockb package.json ./:
------
Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref kkxxxx: "/bun.lockb": not found