get docker uberjar working

This commit is contained in:
Travis Shears 2025-06-07 16:05:34 +02:00
parent 4acc4e2201
commit c28c398a14
9 changed files with 91 additions and 27 deletions

View file

@ -13,21 +13,17 @@
# it uses alpine for a small image
FROM clojure:temurin-21-tools-deps-alpine AS jre-build
ENV TAILWIND_VERSION=v3.2.4
# Install the missing packages and applications in a single layer
RUN apk add curl rlwrap && curl -L -o /usr/local/bin/tailwindcss \
https://github.com/tailwindlabs/tailwindcss/releases/download/$TAILWIND_VERSION/tailwindcss-linux-x64 \
&& chmod +x /usr/local/bin/tailwindcss
RUN apk add curl rlwrap
WORKDIR /app
COPY deps.edn ./
RUN clj -P
COPY build.clj config.edn ./
COPY src ./src
COPY dev ./dev
COPY resources ./resources
COPY deps.edn .
# construct the application jar
RUN clj -M:dev uberjar && cp target/jar/app.jar . && rm -r target
RUN clj -T:build uber && cp target/snippets-standalone.jar ./app.jar && rm -r target
# This stage (see multi-stage builds) is a bare Java container
# copy over the uberjar from the builder image and run the application
@ -36,11 +32,12 @@ WORKDIR /app
# Take the uberjar from the base image and put it in the final image
COPY --from=jre-build /app/app.jar /app/app.jar
COPY --from=jre-build /app/config.edn /app/
EXPOSE 8080
# By default, run in PROD profile
ENV BIFF_PROFILE=prod
# ENV BIFF_PROFILE=prod
ENV HOST=0.0.0.0
ENV PORT=8080
CMD ["/opt/java/openjdk/bin/java", "-XX:-OmitStackTraceInFastThrow", "-XX:+CrashOnOutOfMemoryError", "-jar", "app.jar"]