Skip to content

Commit b056076

Browse files
committed
ci: create jvm.Dockerfile
1 parent 89f2d0b commit b056076

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

jvm.Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
LABEL authors="cybersokari"
2+
FROM eclipse-temurin:21 as build
3+
# GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT
4+
# environment variables are required for a successful
5+
# AOT compilation process, which starts the app
6+
# before the compilation.
7+
ARG PROJECT_ID
8+
RUN if [ -z "$PROJECT_ID" ]; then \
9+
echo "PROJECT_ID is required but not set"; \
10+
exit 1; \
11+
fi
12+
RUN echo "PROJECT_ID is set to $PROJECT_ID"
13+
ENV GCLOUD_PROJECT=$PROJECT_ID
14+
ENV GOOGLE_APPLICATION_CREDENTIALS=/gcp/cred.json
15+
16+
WORKDIR /app
17+
# Copy the Google Cloud credentials
18+
COPY cred.json $GOOGLE_APPLICATION_CREDENTIALS
19+
# Copy the source code
20+
COPY .mvn/ .mvn/
21+
COPY --chmod=0755 mvnw mvnw
22+
COPY pom.xml .
23+
COPY ./src src/
24+
# Download the dependencies and cache them
25+
RUN ./mvnw dependency:go-offline -DskipTests
26+
# Build the application
27+
RUN ./mvnw package -DskipTests
28+
29+
# Stage 2: Create the final Docker image
30+
FROM bellsoft/liberica-openjre-alpine as final
31+
# Copy the application from the build stage
32+
COPY --from=build /app/target/web-0.0.1-SNAPSHOT.jar .
33+
# Command to run the application
34+
ENTRYPOINT ["java", "-jar", "/web-0.0.1-SNAPSHOT.jar"]
35+
# Expose the port the application runs on
36+
EXPOSE 80

native.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
LABEL authors="cybersokari"
12
FROM ghcr.io/graalvm/graalvm-ce:latest as build
23
# GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT
34
# environment variables are required for a successful

test.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1
1+
LABEL authors="cybersokari"
22
# Dockerfile for running test
33
FROM eclipse-temurin:17-jdk-jammy as base
44
WORKDIR /build

0 commit comments

Comments
 (0)