Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM fedora:latest

WORKDIR /var/lib/cli-java

ENV LANG=C.UTF-8
RUN yum install \
-y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
java-11-openjdk-headless \
bzip2 unzip xz \
bzr git mercurial openssh-clients subversion procps \
gnupg dirmngr \
ca-certificates curl wget \
&& dnf clean all -y

RUN mkdir /main

COPY cli-qpid-jms/target/cli-qpid-jms-1.2.2-SNAPSHOT-*.jar /main/cli-qpid.jar
COPY cli-activemq/target/cli-activemq-1.2.2-SNAPSHOT-*.jar /main/cli-activemq.jar
COPY cli-artemis-jms/target/cli-artemis-jms-1.2.2-SNAPSHOT-*.jar /main/cli-artemis.jar
COPY cli-paho-java/target/cli-paho-java-1.2.2-SNAPSHOT-*.jar /main/cli-paho.jar

COPY create_links.sh /main
RUN bash /main/create_links.sh


RUN groupadd cli-java && useradd -d /var/lib/cli-java -ms /bin/bash -g cli-java -G cli-java cli-java
USER cli-java:cli-java
49 changes: 49 additions & 0 deletions build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

#
# Copyright (c) 2022 Red Hat, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -Eeuo pipefail
set -x

ARCH="amd64 arm64 ppc64le s390x"
VERSION="${1:-latest}"
REGISTRY="${2:-quay.io}"
NAMESPACE="${3:-messaging}"

IMAGE_NAME="${REGISTRY}/${NAMESPACE}/cli-java:${VERSION}"

# https://docs.docker.com/build/buildx/multiplatform-images/
sudo podman run --privileged --rm docker.io/tonistiigi/binfmt --install all
podman manifest rm ${IMAGE_NAME} || true

# https://gitlab.cee.redhat.com/keycloak/rhsso-openshift-intermediate-docker-image/-/blob/main/build.sh
echo "Creating a new manifest: ${IMAGE_NAME}"
podman manifest create ${IMAGE_NAME}

echo "Building a new docker image: ${IMAGE_NAME}, arch: ${ARCH}"
for i in $ARCH
do
podman build --arch=$i -t ${IMAGE_NAME}.${i} --build-arg ARCH=${i} --build-arg VERSION=${VERSION} .
podman push ${IMAGE_NAME}.${i}
podman manifest add ${IMAGE_NAME} ${IMAGE_NAME}.${i}
done

echo "Pushing a new manifest: ${IMAGE_NAME}"
podman manifest push ${IMAGE_NAME} docker://${IMAGE_NAME}
5 changes: 5 additions & 0 deletions build_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -Eeuo pipefail
set -x

mvn -B package --file pom.xml -DskipTests
34 changes: 34 additions & 0 deletions create_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -Eeuo pipefail
set -x

#
# Copyright (c) 2022 Red Hat, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

cd /main; for i in *.jar; do
for j in sender receiver connector; do
filename="/usr/local/bin/${i%.jar}-${j}"
cat > "${filename}" << EOF
#!/bin/sh

java \${JAVA_OPTS} \${CLI_QPID_JMS_OPTS} -jar /main/${i} ${j} \$@
EOF
chmod +x "$filename"
done
done