Skip to content

Commit

Permalink
DBZ-7385 reduce docker image size
Browse files Browse the repository at this point in the history
  • Loading branch information
eizners authored and jpechane committed Jan 31, 2024
1 parent b7a9a74 commit fb30852
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
15 changes: 14 additions & 1 deletion server/2.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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

Expand Down
21 changes: 17 additions & 4 deletions server/2.6/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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

#
Expand Down
15 changes: 14 additions & 1 deletion server/snapshot/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit fb30852

Please sign in to comment.