# syntax=docker/dockerfile:1.4.0 ARG MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress -Dmaven.test.skip" # Copy all project files FROM docker.io/maven:3.9-eclipse-temurin-21 AS setup WORKDIR /app COPY . . RUN --mount=type=cache,target=/root/.m2/ \ mvn ${MAVEN_CLI_OPTS} package # Create final monolith FROM docker.io/eclipse-temurin:21-jdk-jammy AS monolith WORKDIR /app COPY --from=setup /app/monolith/target/monolith-*-fat.jar /app/monolith.jar CMD ["java", "-jar", "/app/monolith.jar"] # Create final web FROM docker.io/eclipse-temurin:21-jdk-jammy AS web WORKDIR /app COPY --from=setup /app/web/target/web-*-fat.jar /app/web.jar EXPOSE 8080 CMD ["java", "-jar", "/app/web.jar"] # Create final migration FROM docker.io/eclipse-temurin:21-jdk-jammy AS migration WORKDIR /app COPY --from=setup /app/migration/target/migration-*-fat.jar /app/migration.jar CMD ["java", "-jar", "/app/migration.jar"] # Create final bot FROM docker.io/eclipse-temurin:21-jdk-jammy AS bot WORKDIR /app COPY --from=setup /app/bot/target/bot-*-fat.jar /app/bot.jar CMD ["java", "-jar", "/app/bot.jar"] # Build the ui FROM docker.io/node:18-alpine AS ui-build WORKDIR /ui COPY ui/package.json ui/package-lock.json . RUN npm ci COPY ui . RUN npm run build # Create final ui FROM docker.io/nginx AS ui COPY --from=ui-build ui/dist /usr/share/nginx/html # Create caddy reverse proxy FROM docker.io/caddy AS caddy RUN < /etc/caddy/Caddyfile { debug auto_https off } :8080 { route { reverse_proxy /api/* monolith:8080 reverse_proxy ui:80 } } EOF EXPOSE 8080