ui icon indicating copy to clipboard operation
ui copied to clipboard

Building project with Docker gets stuck at transforming

Open GlitchDevX opened this issue 1 year ago • 12 comments

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.16.2

Reproduction

https://github.com/GlitchDevX/nuxt-docker-build

GitHub Actions: Working Example Stuck Example

Description

I was trying to create a dockerfile being able to build the complete project without any extra commands to execute beforehand. To do that I tried using a node image as base of the builder part of my multipart dockerfile.

In the building process the npm ci command is executed correctly. However npm run generate or npm run build will get stuck at the transforming step.

I pinned the issue down to the tailwindcss import in the main.css as explained in the nuxt ui starter guide. As when this import is commented out the build will succeed without any issues.

I already tried using different node base images, but it didn't change anything.

Additional context

With tailwindcss import:

Image

Without tailwindcss import:

Image

I created a branch for the minimally changed version without the tailwind css for easier switching in the reproduction repo.

Logs


GlitchDevX avatar Apr 12 '25 19:04 GlitchDevX

Hi @GlitchDevX. I have the same issue. Did you found a solution ?

julbd avatar Jun 18 '25 06:06 julbd

Hey @julbd, unfortunately not. I don't have any idea on how to debug this problem, as it has to do something with the Tailwind CSS import when transforming the project.

GlitchDevX avatar Jun 18 '25 07:06 GlitchDevX

I had the same problem, I was using Bun to build the project. I had to switch to pnpm only in the Dockerfile to get the build to go smoothly without getting stuck in the loop.

zAlweNy26 avatar Jun 18 '25 07:06 zAlweNy26

@zAlweNy26 I am using pnpm 10.10.0

julbd avatar Jun 18 '25 07:06 julbd

I had the same problem, I was using Bun to build the project. I had to switch to pnpm only in the Dockerfile to get the build to go smoothly without getting stuck in the loop.

Thanks for the hint, I will try it on a branch in the reproduction project.

GlitchDevX avatar Jun 18 '25 07:06 GlitchDevX

@zAlweNy26 I am using pnpm 10.10.0

I'm using 9.15.9, I don't know if downgrading could help. I hope this issue get fixed also for Bun, as I'm using it for development.

zAlweNy26 avatar Jun 18 '25 07:06 zAlweNy26

With DEBUG=true I have the following :

 => => # ℹ transforming...
 => => # [40.56ms] [@tailwindcss/vite] Generate CSS (build)
 => => # [12.45ms]   ↳ Setup compiler
 => => # [26.56ms]   ↳ Setup scanner

Then it is stuck with exactly 100% cpu usage.

Also, I have this issue only with DOCKER_DEFAULT_PLATFORM="linux/x86_64". Building for arm64 works without any issue.

Update : fixed by disabling Rosetta for x86_64/amd64 emulation on Apple Silicon like described in https://github.com/tailwindlabs/tailwindcss/issues/17728#issuecomment-2884340873

julbd avatar Jun 18 '25 07:06 julbd

@zAlweNy26 suggested to use pnpm. So I've created a new branch in my reproduction repo using pnpm, however I can't get the nuxt build working without using --shamefully-hoist even outside the docker context.

Inside the docker context (using the parameter) it still gets stuck at the transforming step. Am I missing something?

Here are the links to the new reproduction: GH Action Build Branch

GlitchDevX avatar Jun 18 '25 20:06 GlitchDevX

@GlitchDevX

If you're using pnpm, ensure that you either set shamefully-hoist=true in your .npmrc file or install tailwindcss in your project's root directory. https://ui.nuxt.com/getting-started/installation/nuxt

julbd avatar Jun 19 '25 08:06 julbd

I fixed this problem for myself a week ago: Check if you have recursive classes (endless loops)

I had something like this:

.ui-class {
   .dark,
   &--dark {
      @extend .ui-class;
   }
}

justsomexanda avatar Jun 19 '25 09:06 justsomexanda

Okay I was able to get it working, but found even weirder behavior. The command pnpm generate will only work when executed with a custom build output dir.

So it works when I execute the build inside the docker build with this command:

RUN pnpm generate -- result
# or any other directory name

# you'd also need to change the copy statement to
COPY --from=builder result/.output/public /usr/share/nginx/html

But not like this:

RUN pnpm generate

I've created another reproduction branch here: GitHub Action Branch

GlitchDevX avatar Jun 20 '25 18:06 GlitchDevX

Hi! 👋 This issue was automatically closed due to inactivity. If it's still relevant with the latest Nuxt UI version, feel free to reopen or create a new issue.

github-actions[bot] avatar Aug 28 '25 02:08 github-actions[bot]