Created
December 18, 2022 10:08
-
-
Save ZCube/47f20861fe526a1d0653ae9ada734014 to your computer and use it in GitHub Desktop.
elasticsearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.19-bullseye AS golang-builder | |
RUN mkdir -p /opt/bitnami | |
ADD packages.sh /packages.sh | |
RUN chmod +x /packages.sh && \ | |
/packages.sh | |
FROM mikefarah/yq:4.30.5 AS yq | |
FROM docker.io/bitnami/minideb:bullseye | |
ARG ELASTICSEARCH_PLUGINS | |
ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" | |
ARG TARGETARCH | |
LABEL org.opencontainers.image.authors="https://github.com/ZCube/bitnami-compat" \ | |
org.opencontainers.image.description="Application repackaged by ZCube for arm64 compatible, originaly Bitnami" \ | |
org.opencontainers.image.ref.name="7.17.8-debian-11-r44" \ | |
org.opencontainers.image.source="https://github.com/ZCube/bitnami-compat" \ | |
org.opencontainers.image.title="elasticsearch" \ | |
org.opencontainers.image.vendor="ZCube" \ | |
org.opencontainers.image.version="7.17.8" | |
ENV HOME="/" \ | |
OS_ARCH="${TARGETARCH:-amd64}" \ | |
OS_FLAVOUR="debian-11" \ | |
OS_NAME="linux" \ | |
PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/elasticsearch/bin:$PATH" | |
COPY prebuildfs / | |
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | |
# Install required system packages and dependencies | |
RUN install_packages ca-certificates curl libasound2-dev libc6 libfreetype6 libfreetype6-dev libgcc1 procps zlib1g | |
RUN echo install global | |
COPY --from=golang-builder /opt/bitnami/ /opt/bitnami/ | |
# Reference : https://www.elastic.co/guide/en/elasticsearch/reference/current/targz.html | |
RUN install_packages wget | |
ENV ELASTICSEARCH_VERSION 7.17.8 | |
ENV ES_JAVA_HOME=/opt/bitnami/java | |
RUN mkdir -p /opt/bitnami \ | |
&& cd /opt/bitnami \ | |
&& wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-$(uname -m).tar.gz \ | |
&& wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-$(uname -m).tar.gz.sha512 \ | |
&& cat elasticsearch-${ELASTICSEARCH_VERSION}-linux-$(uname -m).tar.gz.sha512 | sha512sum --check - \ | |
&& tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-$(uname -m).tar.gz \ | |
&& mv elasticsearch-${ELASTICSEARCH_VERSION}/ elasticsearch \ | |
&& rm -rf elasticsearch-${ELASTICSEARCH_VERSION}-linux-$(uname -m)* \ | |
&& chown 1001:1001 -R /opt/bitnami/elasticsearch | |
RUN mv /opt/bitnami/elasticsearch/config/elasticsearch.yml /opt/bitnami/elasticsearch/config/es_config.sample | |
RUN install_packages curl unzip zip | |
RUN curl -fsSL "https://get.sdkman.io" | bash \ | |
&& bash -c ". $HOME/.sdkman/bin/sdkman-init.sh \ | |
&& sdk install java 17.0.3-tem" \ | |
&& mkdir -p /opt/bitnami \ | |
&& ln -sf $HOME/.sdkman/candidates/java/current /opt/bitnami/java | |
ENV JAVA_HOME=$HOME/.sdkman/candidates/java/current | |
ADD https://raw.githubusercontent.com/mikefarah/yq/master/LICENSE /opt/bitnami/common/licenses/LICENSE | |
COPY --from=yq /usr/bin/yq /opt/bitnami/common/bin/ | |
RUN apt-get update && apt-get upgrade -y && \ | |
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives | |
RUN chmod g+rwX /opt/bitnami | |
COPY rootfs / | |
RUN /opt/bitnami/scripts/elasticsearch/postunpack.sh | |
RUN /opt/bitnami/scripts/java/postunpack.sh | |
ENV APP_VERSION="7.17.8" \ | |
BITNAMI_APP_NAME="elasticsearch" \ | |
ES_JAVA_HOME="/opt/bitnami/java" \ | |
JAVA_HOME="/opt/bitnami/java" \ | |
LD_LIBRARY_PATH="/opt/bitnami/elasticsearch/jdk/lib:/opt/bitnami/elasticsearch/jdk/lib/server:$LD_LIBRARY_PATH" | |
EXPOSE 9200 9300 | |
USER 1001 | |
ENTRYPOINT [ "/opt/bitnami/scripts/elasticsearch/entrypoint.sh" ] | |
CMD [ "/opt/bitnami/scripts/elasticsearch/run.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
export PACKAGE=gosu | |
export TARGET_DIR=common | |
export VERSION=1.14.0 | |
export REF=1.14 | |
export CGO_ENABLED=0 | |
rm -rf ${PACKAGE} || true | |
mkdir -p ${PACKAGE} | |
git clone -b "${REF}" https://github.com/tianon/gosu ${PACKAGE} | |
pushd ${PACKAGE} | |
go mod download | |
go build -v -ldflags '-d -s -w' . | |
mkdir -p /opt/bitnami/${TARGET_DIR}/licenses | |
mkdir -p /opt/bitnami/${TARGET_DIR}/bin | |
cp -f LICENSE /opt/bitnami/${TARGET_DIR}/licenses/${PACKAGE}-${VERSION}.txt | |
cp -f ${PACKAGE} /opt/bitnami/${TARGET_DIR}/bin/gosu | |
popd | |
rm -rf ${PACKAGE} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment