-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: bump Dockerfile to use java 21 and gradle 8.12
- Loading branch information
Showing
4 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
# Build Rainbow jar | ||
FROM gradle:8.5-alpine AS build | ||
# | ||
# Build Rainbow API jar | ||
# | ||
FROM gradle:8.12.0-jdk21-alpine AS build | ||
|
||
COPY --chown=gradle:gradle . /home/gradle/src | ||
WORKDIR /home/gradle/src | ||
WORKDIR /home/gradle | ||
COPY --chown=gradle:gradle build.gradle src/ /home/gradle/src/ | ||
COPY --chown=gradle:gradle build.gradle settings.gradle /home/gradle/ | ||
|
||
RUN gradle build --no-daemon # no daemon since building only once | ||
|
||
# | ||
# Launch Rainbow API | ||
FROM openjdk:17-jdk-slim AS start | ||
# | ||
FROM eclipse-temurin:21-alpine AS runtime | ||
|
||
RUN mkdir /src | ||
COPY --from=build /home/gradle/src/build/libs/rainbow-1.0.0.jar /src/rainbow-1.0.0.jar | ||
ARG API_NAME=rainbow-api | ||
ARG API_VERSION=1.1.0 | ||
|
||
ENTRYPOINT ["java","-jar","/src/rainbow-1.0.0.jar"] | ||
LABEL name=$API_NAME \ | ||
version=$API_VERSION \ | ||
author="Derek Garcia" \ | ||
description="API service to navigate and search courses available at the University of Hawaii" | ||
|
||
RUN adduser -D rainbow | ||
|
||
WORKDIR /rainbow | ||
COPY --from=build --chown=rainbow:rainbow /home/gradle/build/libs/$API_NAME-$API_VERSION.jar /rainbow/rainbow.jar | ||
|
||
USER rainbow | ||
ENTRYPOINT ["java","-jar","rainbow.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Parse version from properties | ||
VERSION="1.1.0" | ||
|
||
# Build jar | ||
echo "Building jar. . ." | ||
./gradlew -q clean bootJar | ||
|
||
# Launch jar | ||
echo "Done! Launching api. . ." | ||
java -jar ./build/libs/rainbow-${VERSION}.jar |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters