Skip to content

Error while building with Bun in Docker #690

@zAlweNy26

Description

@zAlweNy26

Hi, I'm trying to use [email protected] in my Dockerfile, but I'm unable to build my project cause of this error:

ERROR  Error while importing module @nuxt/fonts: ResolveMessage: Cannot find module '../data/patch.json' from 'undefined'
9.645
9.645     at loadNuxtModuleInstance (node_modules/@nuxt/ui/node_modules/@nuxt/kit/dist/index.mjs:576:19)
9.645     at processTicksAndRejections (native:7:39)

I got this error only inside Docker. When I build locally, everything works just fine.
This is my Dockerfile:

FROM oven/bun:1.2-alpine AS base

WORKDIR /app

FROM base AS install

RUN apk add --no-cache bash

COPY package.json bun.lock fix-ui.sh ./
COPY ./patches ./patches

RUN bun install --frozen-lockfile --production

# Build stage
FROM install AS build

COPY . .

RUN bun run build

FROM base AS runtime

WORKDIR /app

# Create a non-root user
RUN addgroup -g 1001 -S bunny && adduser -S nuxt -u 1001 -G bunny

COPY --from=build /app/.output ./.output

RUN chown -R nuxt:bunny /app

USER nuxt

EXPOSE 3000/tcp

# Run the app
CMD [ "bun", "run", ".output/server/index.mjs" ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions