diff --git a/server/2.6/Dockerfile b/server/2.6/Dockerfile index 4cd129fa..cae967f4 100644 --- a/server/2.6/Dockerfile +++ b/server/2.6/Dockerfile @@ -1,4 +1,5 @@ -FROM registry.access.redhat.com/ubi8/openjdk-11 +# Stage 1: Build stage +FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder LABEL maintainer="Debezium Community" @@ -47,6 +48,18 @@ RUN echo "$SERVER_MD5 /tmp/debezium.tar.gz" | md5sum -c - &&\ # RUN chmod -R g+w,o+w $SERVER_HOME +# Stage 2: Final image +FROM registry.access.redhat.com/ubi8/openjdk-11 + +ENV SERVER_HOME=/debezium + +USER root +RUN microdnf clean all + +USER jboss + +COPY --from=builder $SERVER_HOME $SERVER_HOME + # Set the working directory to the Debezium Server home directory WORKDIR $SERVER_HOME diff --git a/server/2.6/Dockerfile.local b/server/2.6/Dockerfile.local index 6741cdb5..75d7527c 100644 --- a/server/2.6/Dockerfile.local +++ b/server/2.6/Dockerfile.local @@ -1,4 +1,5 @@ -FROM registry.access.redhat.com/ubi8/openjdk-11 +# Stage 1: Build stage +FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder LABEL maintainer="Debezium Community" @@ -29,19 +30,31 @@ RUN mkdir $SERVER_HOME/conf && \ # # Download and install Debezium Server # -COPY debezium-server-dist-2.2.0-SNAPSHOT.tar.gz /tmp/debezium.tar.gz +COPY debezium-server-dist-2.6.0-SNAPSHOT.tar.gz /tmp/debezium.tar.gz # # Verify the contents and then install ... # -RUN tar xzf /tmp/debezium.tar.gz -C $SERVER_HOME --strip-components 1 +RUN tar xzf /tmp/debezium.tar.gz -C $SERVER_HOME --strip-components 1 &&\ + rm -f /opt/debezium.tar.gz # # Allow random UID to use Debezium Server # RUN chmod -R g+w,o+w $SERVER_HOME -# Set the working directory to the Debezium Server home directory +# Stage 2: Final image +FROM registry.access.redhat.com/ubi8/openjdk-11 + +ENV SERVER_HOME=/debezium + +USER root +RUN microdnf clean all + +USER jboss + +COPY --from=builder $SERVER_HOME $SERVER_HOME + WORKDIR $SERVER_HOME # diff --git a/server/snapshot/Dockerfile b/server/snapshot/Dockerfile index 677c7e20..ab0c6d49 100644 --- a/server/snapshot/Dockerfile +++ b/server/snapshot/Dockerfile @@ -1,4 +1,5 @@ -FROM registry.access.redhat.com/ubi8/openjdk-11 +# Stage 1: Build stage +FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder LABEL maintainer="Debezium Community" @@ -47,6 +48,18 @@ RUN SNAPSHOT_VERSION=$(curl --silent -fSL $MAVEN_OSS_SNAPSHOT/io/debezium/debezi # RUN chmod -R g+w,o+w $SERVER_HOME +# Stage 2: Final image +FROM registry.access.redhat.com/ubi8/openjdk-11 + +ENV SERVER_HOME=/debezium + +USER root +RUN microdnf clean all + +USER jboss + +COPY --from=builder $SERVER_HOME $SERVER_HOME + # Set the working directory to the Debezium Server home directory WORKDIR $SERVER_HOME