File tree Expand file tree Collapse file tree
.github/actions/docker-build-or-tag Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,23 +46,14 @@ runs:
4646 - name : Set up Docker Buildx
4747 uses : docker/setup-buildx-action@v3
4848
49- - name : Set up JDK 17
50- uses : actions/setup-java@v3
51- with :
52- java-version : ' 17'
53- distribution : ' corretto'
54- cache : maven
55-
56- - name : Build with Maven
57- run : mvn clean package -DskipTests
58- shell : bash
59-
6049 - name : Build and push
6150 uses : docker/build-push-action@v6
6251 with :
6352 push : true
6453 platforms : linux/amd64,linux/arm64
6554 context : ${{ inputs.dockerfile-dir }}
55+ cache-from : type=gha
56+ cache-to : type=gha,mode=max
6657 tags : |
6758 ghcr.io/januschung/${{ inputs.image-name }}:${{ env.COMMIT_SHA }}
6859 ghcr.io/januschung/${{ inputs.image-name }}:latest
Original file line number Diff line number Diff line change 1+ # Stage 1: build the application
2+ FROM maven:3.9.4-eclipse-temurin-17 AS build
3+ WORKDIR /workspace
4+ COPY pom.xml ./
5+ COPY .mvn .mvn
6+ # use BuildKit cache for Maven repo
7+ RUN --mount=type=cache,target=/root/.m2 mvn -B -DskipTests dependency:go-offline
8+ COPY src ./src
9+ RUN --mount=type=cache,target=/root/.m2 mvn -B -DskipTests package
10+
11+ # Stage 2: runtime image
112FROM amazoncorretto:17-alpine3.21
2- COPY target/*.jar app.jar
13+ WORKDIR /app
14+ COPY --from=build /workspace/target/*.jar app.jar
315EXPOSE 8080
416ENTRYPOINT ["java" , "-jar" , "/app.jar" ]
You can’t perform that action at this time.
0 commit comments