From 0321c35ceccd73dbe6f7e0760dab6dc3abcbeefa Mon Sep 17 00:00:00 2001 From: chawinphat Date: Wed, 15 Nov 2023 08:15:16 +0000 Subject: [PATCH 1/6] first test of graceful Signed-off-by: chawinphat --- docker/release/build-image-single-arch.sh | 3 +-- .../config/opensearch/opensearch-docker-entrypoint.sh | 2 +- .../dockerfiles/opensearch-dashboards.al2.dockerfile | 8 +++++++- docker/release/dockerfiles/opensearch.al2.dockerfile | 6 ++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docker/release/build-image-single-arch.sh b/docker/release/build-image-single-arch.sh index 02c98e28b8..706aa8fa22 100755 --- a/docker/release/build-image-single-arch.sh +++ b/docker/release/build-image-single-arch.sh @@ -123,6 +123,5 @@ else fi # Docker build -docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION -docker tag opensearchproject/$PRODUCT:$VERSION opensearchproject/$PRODUCT:latest +docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=${arch_uname} diff --git a/docker/release/config/opensearch/opensearch-docker-entrypoint.sh b/docker/release/config/opensearch/opensearch-docker-entrypoint.sh index 4ed61fabfd..75662d4e69 100755 --- a/docker/release/config/opensearch/opensearch-docker-entrypoint.sh +++ b/docker/release/config/opensearch/opensearch-docker-entrypoint.sh @@ -98,7 +98,7 @@ function runOpensearch { setupPerformanceAnalyzerPlugin # Start opensearch - "$@" "${opensearch_opts[@]}" + exec "$@" "${opensearch_opts[@]}" } diff --git a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile index 3e90c82a72..92077dd7fb 100644 --- a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile @@ -52,12 +52,18 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 ARG UID=1000 ARG GID=1000 ARG OPENSEARCH_DASHBOARDS_HOME=/usr/share/opensearch-dashboards +ARG TARGETARCH +ENV TINI_VERSION=v0.19.0 # Update packages # Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`. # Install which to allow running of securityadmin.sh RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all +# Add Tini to use as init (PID1) process. +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +RUN chmod 755 ./tini + # Install Reporting dependencies RUN yum install -y libnss3.so xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype && yum clean all @@ -96,5 +102,5 @@ LABEL org.label-schema.schema-version="1.0" \ "DOCKERFILE"="https://github.com/opensearch-project/opensearch-build/blob/main/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile" # CMD to run -ENTRYPOINT ["./opensearch-dashboards-docker-entrypoint.sh"] +ENTRYPOINT ["./tini", "--", "./opensearch-dashboards-docker-entrypoint.sh"] CMD ["opensearch-dashboards"] diff --git a/docker/release/dockerfiles/opensearch.al2.dockerfile b/docker/release/dockerfiles/opensearch.al2.dockerfile index 3b0be3e221..26f75b63e1 100644 --- a/docker/release/dockerfiles/opensearch.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch.al2.dockerfile @@ -55,12 +55,18 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 ARG UID=1000 ARG GID=1000 ARG OPENSEARCH_HOME=/usr/share/opensearch +ARG TARGETARCH +ENV TINI_VERSION=v0.19.0 # Update packages # Install the tools we need: tar and gzip to unpack the OpenSearch tarball, and shadow-utils to give us `groupadd` and `useradd`. # Install which to allow running of securityadmin.sh RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all +# Add Tini to use as init (PID1) process. +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +RUN chmod 755 ./tini + # Create an opensearch user, group RUN groupadd -g $GID opensearch && \ adduser -u $UID -g $GID -d $OPENSEARCH_HOME opensearch From fe0f69bd7894f41ea3f1394df8ac600fbe0b10f2 Mon Sep 17 00:00:00 2001 From: chawinphat Date: Wed, 15 Nov 2023 09:31:08 +0000 Subject: [PATCH 2/6] updated tini install location Signed-off-by: chawinphat --- .../release/dockerfiles/opensearch-dashboards.al2.dockerfile | 2 +- docker/release/dockerfiles/opensearch.al2.dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile index 92077dd7fb..d1b3bae00d 100644 --- a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile @@ -61,7 +61,7 @@ ENV TINI_VERSION=v0.19.0 RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all # Add Tini to use as init (PID1) process. -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} ./tini RUN chmod 755 ./tini # Install Reporting dependencies diff --git a/docker/release/dockerfiles/opensearch.al2.dockerfile b/docker/release/dockerfiles/opensearch.al2.dockerfile index 26f75b63e1..0ab8acc9fc 100644 --- a/docker/release/dockerfiles/opensearch.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch.al2.dockerfile @@ -64,7 +64,7 @@ ENV TINI_VERSION=v0.19.0 RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all # Add Tini to use as init (PID1) process. -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} ./tini RUN chmod 755 ./tini # Create an opensearch user, group @@ -115,5 +115,5 @@ LABEL org.label-schema.schema-version="1.0" \ "DOCKERFILE"="https://github.com/opensearch-project/opensearch-build/blob/main/docker/release/dockerfiles/opensearch.al2.dockerfile" # CMD to run -ENTRYPOINT ["./opensearch-docker-entrypoint.sh"] +ENTRYPOINT ["./tini", "--", "./opensearch-docker-entrypoint.sh"] CMD ["opensearch"] From c0df09424d5a5f997e377a209fd60489c2e48958 Mon Sep 17 00:00:00 2001 From: chawinphat Date: Wed, 15 Nov 2023 14:55:51 -0800 Subject: [PATCH 3/6] bin tini version working Signed-off-by: chawinphat --- .../dockerfiles/opensearch-dashboards.al2.dockerfile | 6 +++--- docker/release/dockerfiles/opensearch.al2.dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile index d1b3bae00d..8a82f30d2f 100644 --- a/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile @@ -61,8 +61,8 @@ ENV TINI_VERSION=v0.19.0 RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all # Add Tini to use as init (PID1) process. -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} ./tini -RUN chmod 755 ./tini +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +RUN chmod 755 /bin/tini # Install Reporting dependencies RUN yum install -y libnss3.so xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype && yum clean all @@ -102,5 +102,5 @@ LABEL org.label-schema.schema-version="1.0" \ "DOCKERFILE"="https://github.com/opensearch-project/opensearch-build/blob/main/docker/release/dockerfiles/opensearch-dashboards.al2.dockerfile" # CMD to run -ENTRYPOINT ["./tini", "--", "./opensearch-dashboards-docker-entrypoint.sh"] +ENTRYPOINT ["/bin/tini", "--", "./opensearch-dashboards-docker-entrypoint.sh"] CMD ["opensearch-dashboards"] diff --git a/docker/release/dockerfiles/opensearch.al2.dockerfile b/docker/release/dockerfiles/opensearch.al2.dockerfile index 0ab8acc9fc..a5bc73911d 100644 --- a/docker/release/dockerfiles/opensearch.al2.dockerfile +++ b/docker/release/dockerfiles/opensearch.al2.dockerfile @@ -64,8 +64,8 @@ ENV TINI_VERSION=v0.19.0 RUN yum update -y && yum install -y tar gzip shadow-utils which && yum clean all # Add Tini to use as init (PID1) process. -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} ./tini -RUN chmod 755 ./tini +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /bin/tini +RUN chmod 755 /bin/tini # Create an opensearch user, group RUN groupadd -g $GID opensearch && \ @@ -115,5 +115,5 @@ LABEL org.label-schema.schema-version="1.0" \ "DOCKERFILE"="https://github.com/opensearch-project/opensearch-build/blob/main/docker/release/dockerfiles/opensearch.al2.dockerfile" # CMD to run -ENTRYPOINT ["./tini", "--", "./opensearch-docker-entrypoint.sh"] +ENTRYPOINT ["/bin/tini", "--", "./opensearch-docker-entrypoint.sh"] CMD ["opensearch"] From 0dd6b73945df52c125d9510445496e524dadae0b Mon Sep 17 00:00:00 2001 From: chawinphat Date: Thu, 16 Nov 2023 13:25:15 -0800 Subject: [PATCH 4/6] adding back tag Signed-off-by: chawinphat --- docker/release/build-image-single-arch.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/release/build-image-single-arch.sh b/docker/release/build-image-single-arch.sh index 706aa8fa22..69dc7ebd65 100755 --- a/docker/release/build-image-single-arch.sh +++ b/docker/release/build-image-single-arch.sh @@ -124,4 +124,5 @@ fi # Docker build docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=${arch_uname} +docker tag opensearchproject/$PRODUCT:$VERSION opensearchproject/$PRODUCT:latest From b1495dfc591b8651a7b48397758e02dcb28d555f Mon Sep 17 00:00:00 2001 From: chawinphat Date: Sun, 19 Nov 2023 13:37:05 -0800 Subject: [PATCH 5/6] changed to using uname -m Signed-off-by: chawinphat --- docker/release/build-image-single-arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/release/build-image-single-arch.sh b/docker/release/build-image-single-arch.sh index 69dc7ebd65..fb6254dffe 100755 --- a/docker/release/build-image-single-arch.sh +++ b/docker/release/build-image-single-arch.sh @@ -123,6 +123,6 @@ else fi # Docker build -docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=${arch_uname} +docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=$(uname) docker tag opensearchproject/$PRODUCT:$VERSION opensearchproject/$PRODUCT:latest From acbc2ecdc169d8fcc7b1a76d316a06fcb288e765 Mon Sep 17 00:00:00 2001 From: chawinphat Date: Sun, 19 Nov 2023 13:38:04 -0800 Subject: [PATCH 6/6] changed to using uname -m 2 Signed-off-by: chawinphat --- docker/release/build-image-single-arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/release/build-image-single-arch.sh b/docker/release/build-image-single-arch.sh index fb6254dffe..bc2d0ed224 100755 --- a/docker/release/build-image-single-arch.sh +++ b/docker/release/build-image-single-arch.sh @@ -123,6 +123,6 @@ else fi # Docker build -docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=$(uname) +docker build --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -f $DOCKERFILE $DIR -t opensearchproject/$PRODUCT:$VERSION --build-arg TARGETARCH=$(uname -m) docker tag opensearchproject/$PRODUCT:$VERSION opensearchproject/$PRODUCT:latest