From 2dd57fe697f8a40bb3b18a5a647802a91045ee7a Mon Sep 17 00:00:00 2001 From: truestory1 <22789867+truestory1@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:41:07 +0200 Subject: [PATCH] Fix -startup script (#5) * Fix -startup script * chmod fix * use normal ubi image --------- Co-authored-by: A --- Containerfile | 11 +++++++---- start.sh | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 start.sh diff --git a/Containerfile b/Containerfile index 12bf8c0..5531d31 100644 --- a/Containerfile +++ b/Containerfile @@ -1,11 +1,14 @@ -FROM registry.access.redhat.com/ubi8/ubi-init@sha256:d35aff7118921a3a2c2e78507fc7329b499b8fb09d290dc60a44eea6cdeb9b5c +FROM registry.access.redhat.com/ubi8/ubi # Add repositories COPY zscaler.repo /etc/yum.repos.d/ +# Add startup script +COPY start.sh /start.sh + # Install packages and enable services -RUN yum -y install zpa-connector rsyslog && \ +RUN yum -y install zpa-connector && \ yum clean all && \ - systemctl enable zpa-connector rsyslog + chmod +x /start.sh -CMD [ "/sbin/init" ] +CMD [ "/start.sh" ] diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..e1a9746 --- /dev/null +++ b/start.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e + +chown -R zscaler /opt/zscaler +if [ ! -f "/opt/zscaler/var/provision_key" ]; then + echo "Adding provisioning key from environment" + echo ${ZPA_PROVISION_KEY} > /opt/zscaler/var/provision_key +fi + +cd /opt/zscaler/var + +ulimit -n 512000 +arch=$(uname -m) + +if [ "$arch" == 'aarch64' ] || [ ! -z "$LIMITED_MEM" ]; +then + exec /opt/zscaler/bin/zpa-connector -memory_arena_count 1 -container "$@" +else + exec /opt/zscaler/bin/zpa-connector -container "$@" +fi