Skip to content

Commit

Permalink
Use multi-stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev committed Nov 11, 2024
1 parent d14861f commit 997d810
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
with:
context: .
file: deploy/Dockerfile
build-args: |
BUILD_VERSION=$DOCKER_METADATA_OUTPUT_VERSION
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
20 changes: 14 additions & 6 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Stage 1 - collect deps

FROM clojure:temurin-23-tools-deps-noble

WORKDIR /app
Expand All @@ -6,14 +8,20 @@ COPY deps.edn build.clj ./

RUN --mount=type=cache,target=/root/.m2 clojure -T:build copy-deps :target-dir '"deps-jars"'

# Stage 2

FROM eclipse-temurin:23-jdk-noble

ARG BUILD_VERSION

WORKDIR /app

COPY --from=0 /app/deps-jars ./deps-jars

ADD res ./res
ADD src ./src
COPY run.sh ./

CMD ["bash", "/app/run.sh"]

# FROM openjdk:11-jre-slim
RUN echo $BUILD_VERSION > VERSION

# WORKDIR /app

# # COPY --from=0 /app/target/app-standalone.jar ./app.jar
CMD ["bash", "/app/run.sh"]

0 comments on commit 997d810

Please sign in to comment.