Skip to content

Commit

Permalink
use multi-stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbranham committed Dec 1, 2024
1 parent 6b922c7 commit 0d7616f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Production Release
name: Release
on:
push:
branches:
Expand Down Expand Up @@ -44,10 +44,9 @@ jobs:
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64

# Install artifacts locally for the docker build
# Also runs unit/integration tests
- name: Install artifacts locally
run: mvn install
# Build with Maven
- name: Test
run: mvn test


# Cache Docker layers
Expand Down
9 changes: 7 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
ARG BASE_IMAGE=eclipse-temurin
ARG JRE_VERSION=17-jdk


FROM ${BASE_IMAGE}:${JRE_VERSION} as source
WORKDIR /build
COPY . /build/
RUN ./mvnw clean package -DskipTests

FROM ${BASE_IMAGE}:${JRE_VERSION} as builder
WORKDIR /build
COPY webapp/target/*-exec.jar app.jar
COPY --from=source /build/webapp/target/*-exec.jar app.jar
RUN java -Djarmode=layertools -jar app.jar extract

FROM ${BASE_IMAGE}:${JRE_VERSION}

USER root
WORKDIR /app

Expand Down

0 comments on commit 0d7616f

Please sign in to comment.