From 9ae5dc084e5d9c7b61d8244a00058a1f5814ffa5 Mon Sep 17 00:00:00 2001 From: Blair Watt <18262146+udkyo@users.noreply.github.com> Date: Fri, 22 Jul 2022 13:11:54 +0100 Subject: [PATCH] CBD-4825: Produce arm build of SGW 3.0.3 --- community/sync-gateway/3.0.3/Dockerfile | 13 ++++++++++--- community/sync-gateway/3.0.3/scripts/entrypoint.sh | 3 +-- enterprise/sync-gateway/3.0.3/Dockerfile | 13 ++++++++++--- enterprise/sync-gateway/3.0.3/scripts/entrypoint.sh | 3 +-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/community/sync-gateway/3.0.3/Dockerfile b/community/sync-gateway/3.0.3/Dockerfile index d74955c5d..276270d82 100644 --- a/community/sync-gateway/3.0.3/Dockerfile +++ b/community/sync-gateway/3.0.3/Dockerfile @@ -12,9 +12,11 @@ RUN yum -y update && \ yum clean all # Install Sync Gateway -RUN wget http://packages.couchbase.com/releases/couchbase-sync-gateway/3.0.3/couchbase-sync-gateway-community_3.0.3_x86_64.rpm && \ - rpm -i couchbase-sync-gateway-community_3.0.3_x86_64.rpm && \ - rm couchbase-sync-gateway-community_3.0.3_x86_64.rpm +RUN SGW_PACKAGE=$(echo "http://packages.couchbase.com/releases/couchbase-sync-gateway/3.0.3/couchbase-sync-gateway-community_3.0.3_@@ARCH@@.rpm" | sed -e "s/@@ARCH@@/$(uname -m)/") && \ + SGW_PACKAGE_FILENAME=$(echo "couchbase-sync-gateway-community_3.0.3_@@ARCH@@.rpm" | sed -e "s/@@ARCH@@/$(uname -m)/") && \ + wget "${SGW_PACKAGE}" && \ + rpm -i ${SGW_PACKAGE_FILENAME} && \ + rm ${SGW_PACKAGE_FILENAME} # Create directory where the default config stores memory snapshots to disk RUN mkdir /opt/couchbase-sync-gateway/data @@ -22,6 +24,11 @@ RUN mkdir /opt/couchbase-sync-gateway/data # copy the default config into the container COPY config/sync_gateway_config.json /etc/sync_gateway/config.json +# Create log dir +RUN set -x \ + && mkdir -p /var/log/sync_gateway \ + && chown sync_gateway:sync_gateway /var/log/sync_gateway + # Add bootstrap script COPY scripts/entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/community/sync-gateway/3.0.3/scripts/entrypoint.sh b/community/sync-gateway/3.0.3/scripts/entrypoint.sh index 224313c85..b25eb81d5 100755 --- a/community/sync-gateway/3.0.3/scripts/entrypoint.sh +++ b/community/sync-gateway/3.0.3/scripts/entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -LOGFILE_DIR=/var/log/sync_gateway -mkdir -p $LOGFILE_DIR +LOGFILE_DIR=${LOGFILE_DIR:-/var/log/sync_gateway} exec sync_gateway --defaultLogFilePath="${LOGFILE_DIR}" "$@" diff --git a/enterprise/sync-gateway/3.0.3/Dockerfile b/enterprise/sync-gateway/3.0.3/Dockerfile index caaaa4d1d..4cad85ed0 100644 --- a/enterprise/sync-gateway/3.0.3/Dockerfile +++ b/enterprise/sync-gateway/3.0.3/Dockerfile @@ -12,9 +12,11 @@ RUN yum -y update && \ yum clean all # Install Sync Gateway -RUN wget http://packages.couchbase.com/releases/couchbase-sync-gateway/3.0.3/couchbase-sync-gateway-enterprise_3.0.3_x86_64.rpm && \ - rpm -i couchbase-sync-gateway-enterprise_3.0.3_x86_64.rpm && \ - rm couchbase-sync-gateway-enterprise_3.0.3_x86_64.rpm +RUN SGW_PACKAGE=$(echo "http://packages.couchbase.com/releases/couchbase-sync-gateway/3.0.3/couchbase-sync-gateway-enterprise_3.0.3_@@ARCH@@.rpm" | sed -e "s/@@ARCH@@/$(uname -m)/") && \ + SGW_PACKAGE_FILENAME=$(echo "couchbase-sync-gateway-enterprise_3.0.3_@@ARCH@@.rpm" | sed -e "s/@@ARCH@@/$(uname -m)/") && \ + wget "${SGW_PACKAGE}" && \ + rpm -i ${SGW_PACKAGE_FILENAME} && \ + rm ${SGW_PACKAGE_FILENAME} # Create directory where the default config stores memory snapshots to disk RUN mkdir /opt/couchbase-sync-gateway/data @@ -22,6 +24,11 @@ RUN mkdir /opt/couchbase-sync-gateway/data # copy the default config into the container COPY config/sync_gateway_config.json /etc/sync_gateway/config.json +# Create log dir +RUN set -x \ + && mkdir -p /var/log/sync_gateway \ + && chown sync_gateway:sync_gateway /var/log/sync_gateway + # Add bootstrap script COPY scripts/entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/enterprise/sync-gateway/3.0.3/scripts/entrypoint.sh b/enterprise/sync-gateway/3.0.3/scripts/entrypoint.sh index 224313c85..b25eb81d5 100755 --- a/enterprise/sync-gateway/3.0.3/scripts/entrypoint.sh +++ b/enterprise/sync-gateway/3.0.3/scripts/entrypoint.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -LOGFILE_DIR=/var/log/sync_gateway -mkdir -p $LOGFILE_DIR +LOGFILE_DIR=${LOGFILE_DIR:-/var/log/sync_gateway} exec sync_gateway --defaultLogFilePath="${LOGFILE_DIR}" "$@"