Commit 0add76bdcee317cce43e8b352419addfad11dd77
1 parent
fc62d6d7
ci(docker): install nodejs+npm in build stage for :web SPA build
The R1 SPA chunk added a :web Gradle subproject whose npmBuild Exec task runs Vite during :distribution:bootJar. The Dockerfile's build stage uses eclipse-temurin:21-jdk-alpine which has no node/npm, so the docker image CI job fails with: process "/bin/sh -c chmod +x ./gradlew && ./gradlew :distribution:bootJar --no-daemon" did not complete successfully: exit code: 1 Fix: apk add --no-cache nodejs npm before the Gradle build. Alpine 3.21 ships node v22 + npm 10 which Vite 5 + React 18 handle fine. The runtime stage stays a pure JRE image — node is only needed at build time and never makes it into the shipping container.
Showing
1 changed file
with
8 additions
and
0 deletions
Dockerfile
| ... | ... | @@ -10,6 +10,14 @@ |
| 10 | 10 | # will be added before anyone tries to build this image. |
| 11 | 11 | FROM eclipse-temurin:21-jdk-alpine AS build |
| 12 | 12 | |
| 13 | +# Node + npm are required for the :web Gradle subproject's npm-based | |
| 14 | +# Vite build. The bootJar wires the SPA bundle into Spring Boot's | |
| 15 | +# classpath:/static/ via processResources, so a clean container build | |
| 16 | +# of `:distribution:bootJar` transitively runs `:web:npmInstall` and | |
| 17 | +# `:web:npmBuild` and needs npm on PATH. Apk's nodejs/npm packages | |
| 18 | +# track v22.x on Alpine 3.21, which Vite 5 + React 18 are happy with. | |
| 19 | +RUN apk add --no-cache nodejs npm | |
| 20 | + | |
| 13 | 21 | WORKDIR /workspace |
| 14 | 22 | COPY . . |
| 15 | 23 | ... | ... |