Skip to content

Add tini to allow termination signal handling #4217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion docker/release/build-image-single-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function runOpensearch {
setupPerformanceAnalyzerPlugin

# Start opensearch
"$@" "${opensearch_opts[@]}"
exec "$@" "${opensearch_opts[@]}"

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 /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

Expand Down Expand Up @@ -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 ["/bin/tini", "--", "./opensearch-dashboards-docker-entrypoint.sh"]
CMD ["opensearch-dashboards"]
8 changes: 7 additions & 1 deletion docker/release/dockerfiles/opensearch.al2.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /bin/tini

# Create an opensearch user, group
RUN groupadd -g $GID opensearch && \
adduser -u $UID -g $GID -d $OPENSEARCH_HOME opensearch
Expand Down Expand Up @@ -109,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 ["/bin/tini", "--", "./opensearch-docker-entrypoint.sh"]
CMD ["opensearch"]