-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (33 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Build stage
# Gradle 9.5 on JDK 21 runs the wrapper; certo's Gradle toolchain auto-provisions JDK 25 (Foojay) for the
# actual compile, exactly as it builds locally.
# Pinned to $BUILDPLATFORM: the jar is architecture-independent, so in a multi-platform build
# (linux/amd64 + linux/arm64) this stage runs ONCE on the builder's native arch instead of
# repeating the whole Gradle build under QEMU emulation; only the runtime stage below is
# per-platform.
FROM --platform=$BUILDPLATFORM gradle:9.5-jdk21 AS build
WORKDIR /app
# Copy gradle files for dependency caching (Kotlin DSL)
COPY build.gradle.kts settings.gradle.kts gradlew ./
COPY gradle ./gradle
# Download dependencies (cached layer)
RUN ./gradlew dependencies --no-daemon
# Copy source code
COPY src ./src
# Build the application. bootJar (not build/assemble) produces a single executable fat jar — no -plain.jar.
RUN ./gradlew bootJar --no-daemon
# Runtime stage — JRE 25 (certo is compiled to Java 25 bytecode)
FROM eclipse-temurin:25-jre-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -S certo && adduser -S certo -G certo
USER certo:certo
# Copy the built jar from build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Expose application port
EXPOSE 8080
# Default to the prod profile (Postgres + a real siglet). Supply the datasource and
# certo.security.siglet-base-url via environment at run time.
ENV SPRING_PROFILES_ACTIVE=prod
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]