53 lines
1.7 KiB
Docker

FROM cloudron/base:5.0.0
# Install dependencies
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
unzip \
wget \
iproute2 \
net-tools \
iputils-ping \
dnsutils \
openjdk-17-jdk
# Set Elasticsearch version
ENV ELASTIC_VERSION=8.17.3
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
# Create elasticsearch user and group
RUN groupadd elasticsearch && \
useradd -g elasticsearch -s /bin/bash elasticsearch
# Download and install Elasticsearch
RUN mkdir -p /usr/share/elasticsearch && \
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTIC_VERSION}-linux-x86_64.tar.gz && \
tar -xzf elasticsearch-${ELASTIC_VERSION}-linux-x86_64.tar.gz -C /usr/share/ && \
mv /usr/share/elasticsearch-${ELASTIC_VERSION}/* /usr/share/elasticsearch/ && \
rm -rf /usr/share/elasticsearch-${ELASTIC_VERSION} elasticsearch-${ELASTIC_VERSION}-linux-x86_64.tar.gz
# Create necessary directories
RUN mkdir -p /app/data/{elasticsearch,logs,config,secrets,jdk/bin,run} && \
chown -R elasticsearch:elasticsearch /app/data
# Copy configuration files
COPY elasticsearch.yml /app/elasticsearch.yml
COPY start.sh /app/start.sh
COPY stop.sh /app/stop.sh
# Set permissions
RUN chmod +x /app/start.sh /app/stop.sh
# Health check
HEALTHCHECK --interval=15s --timeout=10s --start-period=120s --retries=5 \
CMD curl -fs -u elastic:$(cat /app/data/secrets/elastic_password) http://localhost:9200/_cluster/health?pretty || exit 1
# Command to run
CMD ["/app/start.sh"]