1+ # Stage 1: Build stage
2+ FROM registry.access.redhat.com/ubi8/openjdk-21 AS builder
3+
4+ LABEL maintainer="Debezium Community"
5+
6+ #
7+ # Set the version, home directory, and MD5 hash.
8+ #
9+ ENV DEBEZIUM_VERSION=3.0.8.Final \
10+ SERVER_HOME=/debezium \
11+ MAVEN_REPO_CENTRAL="https://repo1.maven.org/maven2"
12+ ENV SERVER_URL_PATH=io/debezium/debezium-server-dist/$DEBEZIUM_VERSION/debezium-server-dist-$DEBEZIUM_VERSION.tar.gz \
13+ SERVER_MD5=8bbe45300cebec09364a6a1986c1134f
14+
15+ #
16+ # Create a directory for Debezium Server
17+ #
18+ USER root
19+ RUN microdnf -y install gzip && \
20+ microdnf clean all && \
21+ mkdir $SERVER_HOME && \
22+ chmod 755 $SERVER_HOME
23+
24+ #
25+ # Copy local debezium tar file as root
26+ COPY debezium-server-dist/target/debezium-server-dist-3.0.8.Final.tar.gz /tmp/debezium.tar.gz
27+
28+ # Extract the archive and set permissions as root
29+ RUN tar xzf /tmp/debezium.tar.gz -C $SERVER_HOME --strip-components 1 && \
30+ rm -f /tmp/debezium.tar.gz && \
31+ chown -R jboss:jboss $SERVER_HOME && \
32+ chmod -R g+w,o+w $SERVER_HOME
33+
34+ # Switch to jboss user after file operations are complete
35+ USER jboss
36+ RUN mkdir -p $SERVER_HOME/config && \
37+ mkdir -p $SERVER_HOME/data
38+
39+
40+ #
41+ # Allow random UID to use Debezium Server
42+ #
43+ RUN chmod -R g+w,o+w $SERVER_HOME
44+
45+ # Stage 2: Final image
46+ FROM registry.access.redhat.com/ubi8/openjdk-21
47+
48+ LABEL maintainer="Debezium Community"
49+
50+ ENV DEBEZIUM_VERSION=3.0.8.Final \
51+ SERVER_HOME=/debezium \
52+ MAVEN_REPO_CENTRAL="https://repo1.maven.org/maven2"
53+
54+ USER root
55+ RUN microdnf clean all
56+
57+ USER jboss
58+
59+ COPY --from=builder $SERVER_HOME $SERVER_HOME
60+
61+ # Set the working directory to the Debezium Server home directory
62+ WORKDIR $SERVER_HOME
63+
64+ #
65+ # Expose the ports and set up volumes for the data, transaction log, and configuration
66+ #
67+ EXPOSE 8080
68+ VOLUME ["/debezium/config" ,"/debezium/data" ]
69+
70+ CMD ["/debezium/run.sh" ]
0 commit comments