FROM registry.access.redhat.com/ubi8/openjdk-17:1.15 AS builder

WORKDIR /work
COPY . .

USER 0
RUN microdnf install unzip
RUN mvn clean package -Pprod -Psql -DskipTests -DskipDocsGen

FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.13
USER 185
WORKDIR /work/

COPY --from=builder /work/storage/sql/target/apicurio-registry-storage-sql-*-runner.jar /deployments/apicurio-registry-storage-sql-runner.jar
COPY --from=builder /work/storage/sql/target/lib/ /deployments/lib/

EXPOSE 8080

ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/apicurio-registry-storage-sql-runner.jar"
