fix(build): package frontend assets through Gradle resources

- Backend packaging:
  - make `processResources` include the built frontend dist as an explicit `static/` resource input instead of relying on a manual copy into Gradle's output directory
  - keep `bootJar` as the source of truth for bundling `static/index.html` into the application jar

- Docker build:
  - pass the frontend dist location into Gradle with `-PfrontendDistDir=/tmp/frontend-dist`
  - remove the ad hoc copy into `build/resources/main/static` before `bootJar`

- Validation:
  - verify `processResources` emits `build/resources/main/static/index.html` when given a frontend dist directory
  - keep `git diff --check` clean for the touched packaging files
This commit is contained in:
James Cox
2026-03-20 15:51:42 -05:00
parent 2b2e08b193
commit c4b021f3b9
2 changed files with 15 additions and 5 deletions
+1 -4
View File
@@ -24,11 +24,8 @@ RUN --mount=type=cache,target=/home/gradle/.gradle \
COPY booklore-api/ ./
COPY --from=frontend-build /workspace/booklore-ui/dist/booklore/browser /tmp/frontend-dist
RUN mkdir -p build/resources/main/static && \
cp -r /tmp/frontend-dist/. build/resources/main/static/
RUN --mount=type=cache,target=/home/gradle/.gradle \
./gradlew --no-daemon bootJar
./gradlew --no-daemon -PfrontendDistDir=/tmp/frontend-dist bootJar
RUN set -eux; \
jar_path="$(find build/libs -maxdepth 1 -name '*.jar' ! -name '*plain.jar' | head -n 1)"; \