NuxtN
Nuxt15mo ago
5 replies
Devin

IPX_ERROR when using nuxt/image in dockerfile

Ive created this dockerfile to build my nuxt project like the following:

FROM oven/bun:latest as build

WORKDIR /app
COPY package.json bun.lockb tsconfig.json ./

RUN bun install --verbose

# Copy the rest of the application files
COPY . .

# Build the application for production
RUN bun run build

RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/

FROM node:lts-slim as runner

ENV NODE_ENV=PRODUCTION
EXPOSE 3000

WORKDIR /app

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

ENTRYPOINT ["node", ".output/server/index.mjs"]

Without
RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/

The resulting image is "broken" because i get the IPX_ERROR from nuxt/image when loading my images. Does somebody have an idea, without this workaround?
Was this page helpful?