From 51b0e7b13850a5c9bf9f48ef5aaca4ad4ccc9cf9 Mon Sep 17 00:00:00 2001 From: Avihai Ziv Date: Mon, 15 Apr 2024 23:51:54 +0300 Subject: [PATCH 1/4] added doplar --- docker/Dockerfile | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 2e4e308..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM adoptopenjdk/openjdk16:alpine-jre - -WORKDIR /app - -RUN \ - apk add --no-cache \ - ca-certificates \ - tini \ - tzdata - -COPY . /app -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["java","-jar","/app/doplarr.jar"] - -LABEL "maintainer"="Kiran Shila " -LABEL "org.opencontainers.image.source"="https://github.com/kiranshila/Doplarr" From fff2d0b701e1ec2c6c5c40ef0ef0130c88464657 Mon Sep 17 00:00:00 2001 From: Avihai Ziv Date: Mon, 15 Apr 2024 23:51:54 +0300 Subject: [PATCH 2/4] moved dockerfile to the outside, created a dockerfile compatible with multi-arch builds --- docker/Dockerfile | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 2e4e308..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM adoptopenjdk/openjdk16:alpine-jre - -WORKDIR /app - -RUN \ - apk add --no-cache \ - ca-certificates \ - tini \ - tzdata - -COPY . /app -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["java","-jar","/app/doplarr.jar"] - -LABEL "maintainer"="Kiran Shila " -LABEL "org.opencontainers.image.source"="https://github.com/kiranshila/Doplarr" From acf877b07d84b4b3b3d3e108b42ee3600d848a1e Mon Sep 17 00:00:00 2001 From: Avihai Ziv Date: Mon, 15 Apr 2024 23:55:47 +0300 Subject: [PATCH 3/4] moved dockerfile out --- Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fc9c9e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM clojure:tools-deps-1.11.1.1435 as builder + +WORKDIR /src + +COPY ./deps.edn ./config.edn ./ +COPY ./build/ /src/build +COPY ./src/ /src/src + +RUN clojure -P +RUN clojure -T:build uber + +ENTRYPOINT [ "sh" ] + +FROM eclipse-temurin:22_36-jre-alpine as runtime + +WORKDIR /app + +RUN \ + apk add --no-cache \ + ca-certificates \ + tini \ + tzdata + +COPY --from=builder /src/target/doplarr.jar . +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["java","-jar","/app/doplarr.jar"] + +LABEL "maintainer"="Kiran Shila " +LABEL "org.opencontainers.image.source"="https://github.com/kiranshila/Doplarr" From 1bc718321804ca8c04cc0cb229858154de96c1af Mon Sep 17 00:00:00 2001 From: Avihai Ziv Date: Tue, 16 Apr 2024 02:28:31 +0300 Subject: [PATCH 4/4] moved dockerfile back to original location, build stage with caching complete --- Dockerfile => docker/Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename Dockerfile => docker/Dockerfile (73%) diff --git a/Dockerfile b/docker/Dockerfile similarity index 73% rename from Dockerfile rename to docker/Dockerfile index fc9c9e6..2e99436 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -2,14 +2,15 @@ FROM clojure:tools-deps-1.11.1.1435 as builder WORKDIR /src -COPY ./deps.edn ./config.edn ./ -COPY ./build/ /src/build -COPY ./src/ /src/src - +# CACHING DEPS +COPY ./deps.edn ./ RUN clojure -P -RUN clojure -T:build uber +RUN clojure -T:build || true -ENTRYPOINT [ "sh" ] +COPY ./build/ /src/build/ +COPY ./src/ /src/src/ + +RUN clojure -T:build uber FROM eclipse-temurin:22_36-jre-alpine as runtime @@ -21,7 +22,7 @@ RUN \ tini \ tzdata -COPY --from=builder /src/target/doplarr.jar . +COPY --from=builder /src/target/doplarr.jar ./ ENTRYPOINT ["/sbin/tini", "--"] CMD ["java","-jar","/app/doplarr.jar"]