44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
ARG BASE_IMAGE=opensearchproject/opensearch:latest
|
|
FROM ${BASE_IMAGE}
|
|
|
|
# Switch to root user to install packages
|
|
USER root
|
|
|
|
# Install dependencies for configuration
|
|
RUN if command -v dnf >/dev/null 2>&1; then \
|
|
echo "Installing with dnf" && \
|
|
dnf install -y gettext jq && \
|
|
dnf clean all; \
|
|
elif command -v yum >/dev/null 2>&1; then \
|
|
echo "Installing with yum" && \
|
|
yum install -y gettext jq && \
|
|
yum clean all; \
|
|
elif command -v microdnf >/dev/null 2>&1; then \
|
|
echo "Installing with microdnf" && \
|
|
microdnf install -y gettext jq && \
|
|
microdnf clean all; \
|
|
elif command -v apt-get >/dev/null 2>&1; then \
|
|
echo "Installing with apt-get" && \
|
|
apt-get update -y && \
|
|
apt-get install -y gettext-base jq && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
else \
|
|
echo "No package manager found! Checking if envsubst and jq are already available..." && \
|
|
command -v envsubst || echo "envsubst not found" && \
|
|
command -v jq || echo "jq not found"; \
|
|
fi
|
|
|
|
# Copy configuration files and scripts
|
|
COPY rootfs/ /
|
|
|
|
# Create directories and set permissions
|
|
RUN mkdir -p /usr/share/opensearch/config/jvm.options.d && \
|
|
chown -R opensearch:opensearch /usr/share/opensearch && \
|
|
chmod +x /usr/bin/configure-opensearch
|
|
|
|
# Switch back to opensearch user
|
|
USER opensearch
|
|
|
|
# Use our custom entrypoint script
|
|
ENTRYPOINT ["/usr/bin/configure-opensearch"] |