# ----------------------------------------------------------------------- #
FROM docker.io/library/gradle:8.7-jdk AS builder
WORKDIR /
COPY ./src/main/ ./src/main/
COPY ./frontend/ ./frontend/
COPY ./build.gradle ./
COPY ./gradle.properties ./
COPY ./settings.gradle ./
COPY ./gradle/libs.versions.toml ./gradle/
RUN gradle bootJar --no-daemon

# ----------------------------------------------------------------------- #
FROM docker.io/alpine/java:21-jdk AS run

RUN mkdir -p /logs

COPY --from=builder /build/libs/kontor-spring-0.2.0-SNAPSHOT.jar app.jar

EXPOSE 8100

CMD ["java", "-jar", "-Dspring.profiles.active=prod", "-Dvaadin.productionMode=true", "app.jar"]
