fix
This commit is contained in:
53
opensearch.Dockerfile
Normal file
53
opensearch.Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
||||
# Custom OpenSearch Dockerfile with Java 21 for compatibility
|
||||
FROM amazoncorretto:21-alpine AS java-base
|
||||
|
||||
# Download and extract OpenSearch
|
||||
FROM java-base AS opensearch-builder
|
||||
WORKDIR /tmp
|
||||
RUN apk add --no-cache curl tar && \
|
||||
curl -L https://artifacts.opensearch.org/releases/bundle/opensearch/3.2.0/opensearch-3.2.0-linux-x64.tar.gz | \
|
||||
tar -xz && \
|
||||
mv opensearch-3.2.0 /usr/share/opensearch
|
||||
|
||||
# Final runtime image
|
||||
FROM java-base
|
||||
WORKDIR /usr/share/opensearch
|
||||
|
||||
# Create opensearch user
|
||||
RUN addgroup -g 1000 opensearch && \
|
||||
adduser -u 1000 -G opensearch -s /bin/sh -D opensearch
|
||||
|
||||
# Copy OpenSearch from builder stage
|
||||
COPY --from=opensearch-builder --chown=opensearch:opensearch /usr/share/opensearch /usr/share/opensearch
|
||||
|
||||
# Install necessary packages
|
||||
RUN apk add --no-cache bash curl
|
||||
|
||||
# Debug: Check Java installation and set correct paths
|
||||
RUN which java && java -version && \
|
||||
ls -la /usr/lib/jvm/ && \
|
||||
ln -sf /usr/lib/jvm/java-21-amazon-corretto /usr/lib/jvm/default-jvm
|
||||
|
||||
# Set environment variables
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto
|
||||
ENV OPENSEARCH_JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto
|
||||
ENV PATH=$PATH:$JAVA_HOME/bin
|
||||
|
||||
# Create required directories and disable security plugin
|
||||
RUN mkdir -p /usr/share/opensearch/data && \
|
||||
mkdir -p /usr/share/opensearch/logs && \
|
||||
echo "plugins.security.disabled: true" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
echo "discovery.type: single-node" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
echo "cluster.name: storycove-opensearch" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
echo "node.name: opensearch-node" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
echo "bootstrap.memory_lock: false" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
echo "network.host: 0.0.0.0" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||
rm -rf /usr/share/opensearch/plugins/opensearch-performance-analyzer && \
|
||||
chown -R opensearch:opensearch /usr/share/opensearch
|
||||
|
||||
USER opensearch
|
||||
|
||||
EXPOSE 9200 9300
|
||||
|
||||
# Use direct startup command since we're using the tarball distribution
|
||||
ENTRYPOINT ["/usr/share/opensearch/bin/opensearch"]
|
||||
Reference in New Issue
Block a user