-
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.
Merge pull request #17 from sprinthubmobile/develop
GraalVM Native
- Loading branch information
Showing
11 changed files
with
163 additions
and
127 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
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
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
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,36 @@ | ||
LABEL authors="cybersokari" | ||
FROM eclipse-temurin:21 as build | ||
# GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT | ||
# environment variables are required for a successful | ||
# AOT compilation process, which starts the app | ||
# before the compilation. | ||
ARG PROJECT_ID | ||
RUN if [ -z "$PROJECT_ID" ]; then \ | ||
echo "PROJECT_ID is required but not set"; \ | ||
exit 1; \ | ||
fi | ||
RUN echo "PROJECT_ID is set to $PROJECT_ID" | ||
ENV GCLOUD_PROJECT=$PROJECT_ID | ||
ENV GOOGLE_APPLICATION_CREDENTIALS=/gcp/cred.json | ||
|
||
WORKDIR /app | ||
# Copy the Google Cloud credentials | ||
COPY cred.json $GOOGLE_APPLICATION_CREDENTIALS | ||
# Copy the source code | ||
COPY .mvn/ .mvn/ | ||
COPY --chmod=0755 mvnw mvnw | ||
COPY pom.xml . | ||
COPY ./src src/ | ||
# Download the dependencies and cache them | ||
RUN ./mvnw dependency:go-offline -DskipTests | ||
# Build the application | ||
RUN ./mvnw package -DskipTests | ||
|
||
# Stage 2: Create the final Docker image | ||
FROM bellsoft/liberica-openjre-alpine as final | ||
# Copy the application from the build stage | ||
COPY --from=build /app/target/web-0.0.1-SNAPSHOT.jar . | ||
# Command to run the application | ||
ENTRYPOINT ["java", "-jar", "/web-0.0.1-SNAPSHOT.jar"] | ||
# Expose the port the application runs on | ||
EXPOSE 80 |
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,41 @@ | ||
LABEL authors="cybersokari" | ||
FROM ghcr.io/graalvm/graalvm-ce:latest as build | ||
# GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT | ||
# environment variables are required for a successful | ||
# AOT compilation process, which starts the app | ||
# before the compilation. | ||
ARG PROJECT_ID | ||
RUN if [ -z "$PROJECT_ID" ]; then \ | ||
echo "PROJECT_ID is required but not set"; \ | ||
exit 1; \ | ||
fi | ||
RUN echo "PROJECT_ID is set to $PROJECT_ID" | ||
ENV GCLOUD_PROJECT=$PROJECT_ID | ||
ENV GOOGLE_APPLICATION_CREDENTIALS=/gcp/cred.json | ||
|
||
WORKDIR /app | ||
# Copy the Google Cloud credentials | ||
COPY cred.json $GOOGLE_APPLICATION_CREDENTIALS | ||
# Copy the source code | ||
COPY .mvn/ .mvn/ | ||
COPY --chmod=0755 mvnw mvnw | ||
COPY pom.xml . | ||
COPY ./src src/ | ||
# Download the dependencies and cache them | ||
RUN ./mvnw dependency:go-offline -DskipTests | ||
# Build the application | ||
RUN ./mvnw package -Pnative -DskipTests | ||
|
||
# Stage 2: Create the final Docker image | ||
FROM alpine:latest AS final | ||
# Set the working directory | ||
WORKDIR /app | ||
# Installs the libc6-compat package, which provides | ||
# compatibility with glibc-based binaries. | ||
RUN apk add --no-cache libc6-compat | ||
# Copy the native executable from the build stage | ||
COPY --from=build /app/target/web . | ||
# Command to run the application | ||
CMD ["./web"] | ||
# Expose the port the application runs on | ||
EXPOSE 80 |
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
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
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
Oops, something went wrong.