# Dockerfile.app — Spring Boot runtime image for knoe-auth # Build the jar first: make build-auth # Then build this image: make docker-build-auth # # Multi-stage: build stage compiles the jar; runtime stage is minimal JRE. # ── Build stage ────────────────────────────────────────────────────────────── FROM maven:3.9-eclipse-temurin-21 AS build WORKDIR /workspace COPY authority/pom.xml pom.xml # Download dependencies first (layer-cache friendly) RUN mvn -f pom.xml dependency:go-offline -q COPY authority/src src RUN mvn -f pom.xml -DskipTests package -q && \ mv target/knoe-auth.jar /knoe-auth.jar # ── Runtime stage ───────────────────────────────────────────────────────────── FROM eclipse-temurin:21-jre-jammy LABEL org.opencontainers.image.title="knoe-auth" \ org.opencontainers.image.description="Knoe authentication service (Spring Boot)" \ org.opencontainers.image.source="https://github.com/chrisfu/knoe-db" RUN groupadd --system knoe && useradd --system --gid knoe knoe WORKDIR /app COPY --from=build /knoe-auth.jar knoe-auth.jar RUN chown knoe:knoe knoe-auth.jar USER knoe EXPOSE 8080 ENTRYPOINT ["java", "-jar", "/app/knoe-auth.jar"]