@@ -9,6 +9,7 @@ FROM stackable/image/java-devel AS builder
99ARG  PRODUCT
1010ARG  JMX_EXPORTER
1111ARG  STACKABLE_USER_UID
12+ ARG  RELEASE
1213
1314#  Copy patches into the builder
1415COPY  --chown=${STACKABLE_USER_UID}:0 zookeeper/stackable/patches/patchable.toml /stackable/src/zookeeper/stackable/patches/patchable.toml
@@ -23,20 +24,26 @@ WORKDIR /stackable
2324RUN  <<EOF
2425cd "$(/stackable/patchable --images-repo-root=src checkout zookeeper ${PRODUCT})" 
2526
27+ ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
28+ NEW_VERSION="${PRODUCT}-stackable${RELEASE}" 
29+ 
30+ mvn versions:set -DnewVersion=$NEW_VERSION
31+ 
2632#  Create snapshot of the source code including custom patches
27- tar -czf /stackable/zookeeper-${PRODUCT }-src.tar.gz .
33+ tar -czf /stackable/zookeeper-${NEW_VERSION }-src.tar.gz .
2834
2935#  Exclude the `zookeeper-client` submodule, this is not needed and has c parts
3036#  that created all kinds of issues for the build container
3137mvn --batch-mode --no-transfer-progress -pl "!zookeeper-client/zookeeper-client-c"  clean install checkstyle:check spotbugs:check -DskipTests -Pfull-build
3238
3339#  Unpack the archive which contains the build artifacts from above. Remove some
3440#  unused files to shrink the final image size.
35- mv zookeeper-assembly/target/apache-zookeeper-${PRODUCT}-bin.tar.gz /stackable
36- tar -C /stackable -xvzf /stackable/apache-zookeeper-${PRODUCT}-bin.tar.gz
37- mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${PRODUCT}-bin/apache-zookeeper-${PRODUCT}.cdx.json
38- rm -rf /stackable/apache-zookeeper-${PRODUCT}-bin/docs
39- rm /stackable/apache-zookeeper-${PRODUCT}-bin/README_packaging.md
41+ mv zookeeper-assembly/target/apache-zookeeper-${NEW_VERSION}-bin.tar.gz /stackable
42+ tar -C /stackable -xvzf /stackable/apache-zookeeper-${NEW_VERSION}-bin.tar.gz
43+ sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g"  zookeeper-assembly/target/bom.json
44+ mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${NEW_VERSION}-bin/apache-zookeeper-${NEW_VERSION}.cdx.json
45+ rm -rf /stackable/apache-zookeeper-${NEW_VERSION}-bin/docs
46+ rm /stackable/apache-zookeeper-${NEW_VERSION}-bin/README_packaging.md
4047
4148#  Download the JMX exporter jar from our own repo
4249curl "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"  \
@@ -70,8 +77,8 @@ LABEL  \
7077  description="This image is deployed by the Stackable Operator for Apache ZooKeeper." 
7178
7279#  Copy over the ZooKeeper binary folder
73- COPY  --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-bin /stackable/apache-zookeeper-${PRODUCT}-bin/
74- COPY  --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-src.tar.gz /stackable
80+ COPY  --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}- bin /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE }-bin/
81+ COPY  --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-stackable${RELEASE}- src.tar.gz /stackable
7582COPY  --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/jmx /stackable/jmx/
7683COPY  zookeeper/licenses /licenses
7784
@@ -83,14 +90,14 @@ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
8390chmod g=u /stackable/package_manifest.txt
8491rm -rf /var/cache/yum
8592
86- #  Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-bin/
93+ #  Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}- bin/
8794#  to preserve the folder name with the version.
88- ln -s /stackable/apache-zookeeper-${PRODUCT}-bin/ /stackable/zookeeper
95+ ln -s /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}- bin/ /stackable/zookeeper
8996chown -h ${STACKABLE_USER_UID}:0 /stackable/zookeeper
9097
9198#  fix missing permissions
9299chmod g=u /stackable/jmx
93- chmod g=u /stackable/apache-zookeeper-${PRODUCT}-bin/
100+ chmod g=u /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}- bin/
94101EOF
95102
96103#  ----------------------------------------
0 commit comments