Skip to content

Instantly share code, notes, and snippets.

@FranckPachot
Last active March 14, 2023 11:40
Show Gist options
  • Save FranckPachot/d2996e0553c8fd78e9e69fa638848cc9 to your computer and use it in GitHub Desktop.
Save FranckPachot/d2996e0553c8fd78e9e69fa638848cc9 to your computer and use it in GitHub Desktop.
Dockerfile reversed engineered from yugabytedb/yugabyte for almalinux:8
# take the following from the public image: /home/yugabyte /etc/yum.repos.d/CentOS.repo /etc/yum.repos.d/almalinux8.repo /usr/bin/NOTICE.txt /usr/bin/azcopy /usr/local/gsutil
FROM yugabytedb/yugabyte:2.17.1.0-b439 as public_image
# remove those that are re-created later
RUN rm -rf /home/yugabyte/{master,tserver}
FROM almalinux:8
ENV RELEASE=4
ENV USER=root
ENV VERSION=2.17.1.0
ENV container=yugabyte-db
ENV YB_HOME=/home/yugabyte
ENV BOTO_PATH=/home/yugabyte/.boto/config
ENV AZCOPY_LOG_LOCATION=/tmp/azcopy/logs
ENV AZCOPY_JOB_PLAN_LOCATION=/tmp/azcopy/jobs-plan
ENV TINI_VERSION=v0.19.0
ENV BASE_IMAGE=docker.io/library/almalinux:8
# ENTRYPOINT /sbin/tini --
WORKDIR /home/yugabyte
# LABEL name="YugabyteDB maintainer=YugaByte vendor=Yugabyte Inc release=$RELEASE version=$VERSION summary=YugabytDB Image description=YugabyteDB is a free and open-source, distributed, relational, NewSQL database management system designed to handle large amounts of data spanning across multiple availability zones and geographic regions while providing single-digit latency, high availability, and no single point of failure."
RUN if [[ "$BASE_IMAGE" == *"almalinux"* ]]; then yum install -y epel-release; yum install -y python3; ln -s /usr/bin/python3 /usr/bin/python ; fi
RUN /bin/sh -c yum install -y java-1.8.0-openjdk-headless which less bind-utils net-tools rsync && yum install -y openssl openssl-devel diffutils && yum clean all && rm -rf /var/cache/yum
COPY --from=public_image /etc/yum.repos.d/CentOS.repo /etc/yum.repos.d/CentOS.repo
COPY --from=public_image /etc/yum.repos.d/almalinux8.repo /etc/yum.repos.d/almalinux8.repo
RUN if [[ "$BASE_IMAGE" == "registry.access.redhat.com/ubi7"* ]]; then yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && yum install -y --enablerepo=centos-* s3cmd tcpdump iotop sysstat fio && yum upgrade -y ; elif [[ "$BASE_IMAGE" == "registry.access.redhat.com/ubi8"* ]]; then yum update -y --enablerepo=almalinux8* && yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && yum install -y --enablerepo=epel* --enablerepo=almalinux8* s3cmd sysstat iotop tcpdump fio && ln -s /usr/bin/python3 /usr/bin/python && yum upgrade -y ; elif [[ "$BASE_IMAGE" == *"almalinux"* ]]; then yum install -y epel-release && yum install -y s3cmd sysstat iotop tcpdump fio ; else yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && yum install -y s3cmd sysstat iotop tcpdump fio && yum upgrade -y ; fi && yum clean all && rm -rf /var/cache/yum
# get the release from the public image, you can replace this with your own build
COPY --from=public_image /home/yugabyte /home/yugabyte
RUN /home/yugabyte/bin/post_install.sh
RUN ln -s /home/yugabyte/bin/ysqlsh /usr/local/bin/ysqlsh && ln -s /home/yugabyte/bin/cqlsh /usr/local/bin/ycqlsh && ln -s /home/yugabyte/bin/yugabyted /usr/local/bin/yugabyted && ln -s /home/yugabyte/bin/yb-admin /usr/local/bin/yb-admin && ln -s /home/yugabyte/bin/yb-ts-cli /usr/local/bin/yb-ts-cli
RUN export dirs=$(ls /home/yugabyte) && mkdir -p $YB_HOME/{master,tserver} && for dir in $dirs; do ln -s $YB_HOME/$dir $YB_HOME/master/$dir; done && for dir in $dirs; do ln -s $YB_HOME/$dir $YB_HOME/tserver/$dir; done && ln -s /mnt/disk0/yb-data/master/logs $YB_HOME/master/logs && ln -s /mnt/disk0/yb-data/tserver/logs $YB_HOME/tserver/logs && mkdir -p /mnt/disk0/cores && ln -s /mnt/disk0/cores $YB_HOME/cores
RUN mkdir -p /licenses && curl https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/LICENSE.md -o /licenses/LICENSE.md && curl https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/licenses/APACHE-LICENSE-2.0.txt -o /licenses/APACHE-LICENSE-2.0.txt && curl https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt -o /licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt
COPY --from=public_image /usr/bin/NOTICE.txt /usr/bin/NOTICE.txt
COPY --from=public_image /usr/bin/azcopy /usr/bin/azcopy
RUN mkdir /usr/local/gsutil
COPY --from=public_image /usr/local/gsutil /usr/local/gsutil
RUN mkdir -p /home/yugabyte/.boto && echo -e "[GSUtil]\nstate_dir=/tmp/gsutil" > /home/yugabyte/.boto/config && ln -s /usr/local/gsutil/gsutil /usr/bin/gsutil && mkdir -m 777 /tmp/azcopy
RUN curl -L -o /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini && chmod +x /sbin/tini && curl -L -o /tmp/tini.sha256sum https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.sha256sum && egrep $(sha256sum /sbin/tini) /tmp/tini.sha256sum
VOLUME [/mnt/disk0 /mnt/disk1]
EXPOSE 10100 11000 12000 5433 6379 7000 7100 7200 9000 9042 9100
USER root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment