Skip to content

Commit 720321f

Browse files
committed
DBZ-7385 reduce docker image size
1 parent 7083dbb commit 720321f

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

server/2.6/Dockerfile

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-11
1+
# Stage 1: Build stage
2+
FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder
23

34
LABEL maintainer="Debezium Community"
45

@@ -47,6 +48,18 @@ RUN echo "$SERVER_MD5 /tmp/debezium.tar.gz" | md5sum -c - &&\
4748
#
4849
RUN chmod -R g+w,o+w $SERVER_HOME
4950

51+
# Stage 2: Final image
52+
FROM registry.access.redhat.com/ubi8/openjdk-11
53+
54+
ENV SERVER_HOME=/debezium
55+
56+
USER root
57+
RUN microdnf clean all
58+
59+
USER jboss
60+
61+
COPY --from=builder $SERVER_HOME $SERVER_HOME
62+
5063
# Set the working directory to the Debezium Server home directory
5164
WORKDIR $SERVER_HOME
5265

server/2.6/Dockerfile.local

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-11
1+
# Stage 1: Build stage
2+
FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder
23

34
LABEL maintainer="Debezium Community"
45

@@ -29,19 +30,31 @@ RUN mkdir $SERVER_HOME/conf && \
2930
#
3031
# Download and install Debezium Server
3132
#
32-
COPY debezium-server-dist-2.2.0-SNAPSHOT.tar.gz /tmp/debezium.tar.gz
33+
COPY debezium-server-dist-2.6.0-SNAPSHOT.tar.gz /tmp/debezium.tar.gz
3334

3435
#
3536
# Verify the contents and then install ...
3637
#
37-
RUN tar xzf /tmp/debezium.tar.gz -C $SERVER_HOME --strip-components 1
38+
RUN tar xzf /tmp/debezium.tar.gz -C $SERVER_HOME --strip-components 1 &&\
39+
rm -f /opt/debezium.tar.gz
3840

3941
#
4042
# Allow random UID to use Debezium Server
4143
#
4244
RUN chmod -R g+w,o+w $SERVER_HOME
4345

44-
# Set the working directory to the Debezium Server home directory
46+
# Stage 2: Final image
47+
FROM registry.access.redhat.com/ubi8/openjdk-11
48+
49+
ENV SERVER_HOME=/debezium
50+
51+
USER root
52+
RUN microdnf clean all
53+
54+
USER jboss
55+
56+
COPY --from=builder $SERVER_HOME $SERVER_HOME
57+
4558
WORKDIR $SERVER_HOME
4659

4760
#

server/snapshot/Dockerfile

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM registry.access.redhat.com/ubi8/openjdk-11
1+
# Stage 1: Build stage
2+
FROM registry.access.redhat.com/ubi8/openjdk-11 AS builder
23

34
LABEL maintainer="Debezium Community"
45

@@ -47,6 +48,18 @@ RUN SNAPSHOT_VERSION=$(curl --silent -fSL $MAVEN_OSS_SNAPSHOT/io/debezium/debezi
4748
#
4849
RUN chmod -R g+w,o+w $SERVER_HOME
4950

51+
# Stage 2: Final image
52+
FROM registry.access.redhat.com/ubi8/openjdk-11
53+
54+
ENV SERVER_HOME=/debezium
55+
56+
USER root
57+
RUN microdnf clean all
58+
59+
USER jboss
60+
61+
COPY --from=builder $SERVER_HOME $SERVER_HOME
62+
5063
# Set the working directory to the Debezium Server home directory
5164
WORKDIR $SERVER_HOME
5265

0 commit comments

Comments
 (0)