52 lines
1.6 KiB
Docker
52 lines
1.6 KiB
Docker
FROM cloudron/base:4.0.0
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
curl \
|
|
gnupg-agent \
|
|
unzip \
|
|
wget \
|
|
default-jre \
|
|
iproute2 \
|
|
net-tools \
|
|
iputils-ping \
|
|
dnsutils
|
|
|
|
# Set environment variables
|
|
ENV ELASTIC_VERSION=8.17.3
|
|
|
|
# Create elasticsearch user and group with dynamic ID allocation
|
|
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} && \
|
|
rm elasticsearch-${ELASTIC_VERSION}-linux-x86_64.tar.gz
|
|
|
|
# Set up directories
|
|
RUN mkdir -p /app/data/elasticsearch && \
|
|
mkdir -p /app/data/logs && \
|
|
mkdir -p /app/data/config && \
|
|
mkdir -p /app/data/secrets
|
|
|
|
# Copy configuration files
|
|
COPY elasticsearch.yml /app/data/config/elasticsearch.yml.orig
|
|
COPY elasticsearch.yml /app/elasticsearch.yml
|
|
COPY .env /app/.env
|
|
COPY start.sh /app/start.sh
|
|
COPY stop.sh /app/stop.sh
|
|
|
|
# Make scripts executable
|
|
RUN chmod +x /app/start.sh /app/stop.sh
|
|
|
|
# Add healthcheck
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=60s --retries=3 \
|
|
CMD curl -f -u elastic:$(cat /app/data/secrets/elastic_password 2>/dev/null || echo "cloudron") http://localhost:9200 || exit 1
|
|
|
|
CMD ["/app/start.sh"] |