+21
@@ -1,3 +1,23 @@
|
||||
# Stage 1: compile the re-frame UI (ui/) to JS. shadow-cljs needs Node and a JVM. It writes
|
||||
# to ../resources/public/js (see ui/shadow-cljs.edn), i.e. /build/resources/public/js here.
|
||||
# trixie, not bookworm: its default-jre is Java 21, which shadow-cljs's Closure Compiler
|
||||
# requires (bookworm's is 17 -> UnsupportedClassVersionError).
|
||||
FROM node:22-trixie-slim AS ui
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends default-jre-headless \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /build/ui
|
||||
COPY ui/package.json ui/package-lock.json ./
|
||||
RUN npm ci
|
||||
# Resolve the ClojureScript deps in their own layer so source edits don't re-download them.
|
||||
COPY ui/shadow-cljs.edn ./
|
||||
RUN npx shadow-cljs classpath > /dev/null
|
||||
COPY ui/src ./src
|
||||
RUN npx shadow-cljs release app
|
||||
|
||||
# Stage 2: the server.
|
||||
FROM clojure:openjdk-11-tools-deps
|
||||
|
||||
RUN sed -i \
|
||||
@@ -17,6 +37,7 @@ RUN clojure -P -X:${DEPS_ALIASES} \
|
||||
&& echo "[build] cached jars: $(find /root/.m2 -name '*.jar' | wc -l)"
|
||||
|
||||
COPY . .
|
||||
COPY --from=ui /build/resources/public/js resources/public/js
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user