2023-03-30 16:07:40 +00:00
|
|
|
# The Dockerfile.ubuntu exists for the tests/ci/docker_server.py script
|
|
|
|
# If the image is built from Dockerfile.alpine, then the `-alpine` suffix is added automatically,
|
|
|
|
# so the only purpose of Dockerfile.ubuntu is to push `latest`, `head` and so on w/o suffixes
|
2024-11-06 09:50:45 +00:00
|
|
|
FROM ubuntu:22.04 AS glibc-donor
|
2022-03-31 21:47:11 +00:00
|
|
|
ARG TARGETARCH
|
2023-10-17 09:30:24 +00:00
|
|
|
|
2022-03-31 21:47:11 +00:00
|
|
|
RUN arch=${TARGETARCH:-amd64} \
|
|
|
|
&& case $arch in \
|
|
|
|
amd64) rarch=x86_64 ;; \
|
|
|
|
arm64) rarch=aarch64 ;; \
|
|
|
|
esac \
|
2024-11-06 09:50:45 +00:00
|
|
|
&& ln -s "${rarch}-linux-gnu" /lib/linux-gnu \
|
|
|
|
&& case $arch in \
|
|
|
|
amd64) ln /lib/linux-gnu/ld-linux-x86-64.so.2 /lib/linux-gnu/ld-2.35.so ;; \
|
|
|
|
arm64) ln /lib/linux-gnu/ld-linux-aarch64.so.1 /lib/linux-gnu/ld-2.35.so ;; \
|
|
|
|
esac
|
2022-03-31 21:47:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
ENV LANG=en_US.UTF-8 \
|
|
|
|
LANGUAGE=en_US:en \
|
|
|
|
LC_ALL=en_US.UTF-8 \
|
|
|
|
TZ=UTC \
|
|
|
|
CLICKHOUSE_CONFIG=/etc/clickhouse-server/config.xml
|
|
|
|
|
2024-11-06 09:50:45 +00:00
|
|
|
COPY --from=glibc-donor /lib/linux-gnu/libc.so.6 /lib/linux-gnu/libdl.so.2 /lib/linux-gnu/libm.so.6 /lib/linux-gnu/libpthread.so.0 /lib/linux-gnu/librt.so.1 /lib/linux-gnu/libnss_dns.so.2 /lib/linux-gnu/libnss_files.so.2 /lib/linux-gnu/libresolv.so.2 /lib/linux-gnu/ld-2.35.so /lib/
|
2022-03-31 21:47:11 +00:00
|
|
|
COPY --from=glibc-donor /etc/nsswitch.conf /etc/
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
2022-04-04 22:24:39 +00:00
|
|
|
|
|
|
|
ARG TARGETARCH
|
2022-03-31 21:47:11 +00:00
|
|
|
RUN arch=${TARGETARCH:-amd64} \
|
|
|
|
&& case $arch in \
|
|
|
|
amd64) mkdir -p /lib64 && ln -sf /lib/ld-2.31.so /lib64/ld-linux-x86-64.so.2 ;; \
|
|
|
|
arm64) ln -sf /lib/ld-2.31.so /lib/ld-linux-aarch64.so.1 ;; \
|
|
|
|
esac
|
|
|
|
|
2023-10-17 09:30:24 +00:00
|
|
|
# lts / testing / prestable / etc
|
|
|
|
ARG REPO_CHANNEL="stable"
|
|
|
|
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
2024-11-01 08:50:54 +00:00
|
|
|
ARG VERSION="24.10.1.2812"
|
2022-03-31 21:47:11 +00:00
|
|
|
ARG PACKAGES="clickhouse-keeper"
|
2023-12-18 08:07:22 +00:00
|
|
|
ARG DIRECT_DOWNLOAD_URLS=""
|
2022-03-31 21:47:11 +00:00
|
|
|
|
|
|
|
# user/group precreated explicitly with fixed uid/gid on purpose.
|
|
|
|
# It is especially important for rootless containers: in that case entrypoint
|
|
|
|
# can't do chown and owners of mounted volumes should be configured externally.
|
|
|
|
# We do that in advance at the begining of Dockerfile before any packages will be
|
|
|
|
# installed to prevent picking those uid / gid by some unrelated software.
|
|
|
|
# The same uid / gid (101) is used both for alpine and ubuntu.
|
2024-03-22 03:39:32 +00:00
|
|
|
ARG DEFAULT_UID="101"
|
|
|
|
ARG DEFAULT_GID="101"
|
|
|
|
RUN addgroup -S -g "${DEFAULT_GID}" clickhouse && \
|
|
|
|
adduser -S -h "/var/lib/clickhouse" -s /bin/bash -G clickhouse -g "ClickHouse keeper" -u "${DEFAULT_UID}" clickhouse
|
2022-03-31 21:47:11 +00:00
|
|
|
|
|
|
|
ARG TARGETARCH
|
|
|
|
RUN arch=${TARGETARCH:-amd64} \
|
2023-12-18 08:07:22 +00:00
|
|
|
&& cd /tmp && rm -f /tmp/*tgz && rm -f /tmp/*tgz.sha512 |: \
|
|
|
|
&& if [ -n "${DIRECT_DOWNLOAD_URLS}" ]; then \
|
|
|
|
echo "installing from provided urls with tgz packages: ${DIRECT_DOWNLOAD_URLS}" \
|
|
|
|
&& for url in $DIRECT_DOWNLOAD_URLS; do \
|
|
|
|
echo "Get ${url}" \
|
|
|
|
&& wget -c -q "$url" \
|
|
|
|
; done \
|
|
|
|
else \
|
|
|
|
for package in ${PACKAGES}; do \
|
|
|
|
cd /tmp \
|
|
|
|
&& echo "Get ${REPOSITORY}/${package}-${VERSION}-${arch}.tgz" \
|
2023-10-17 09:34:12 +00:00
|
|
|
&& wget -c -q "${REPOSITORY}/${package}-${VERSION}-${arch}.tgz" \
|
|
|
|
&& wget -c -q "${REPOSITORY}/${package}-${VERSION}-${arch}.tgz.sha512" \
|
2023-12-18 08:07:22 +00:00
|
|
|
; done \
|
|
|
|
fi \
|
|
|
|
&& cat *.tgz.sha512 | sha512sum -c \
|
|
|
|
&& for file in *.tgz; do \
|
|
|
|
if [ -f "$file" ]; then \
|
|
|
|
echo "Unpacking $file"; \
|
|
|
|
tar xvzf "$file" --strip-components=1 -C /; \
|
|
|
|
fi \
|
2022-03-31 21:47:11 +00:00
|
|
|
; done \
|
|
|
|
&& rm /tmp/*.tgz /install -r \
|
|
|
|
&& chmod +x /entrypoint.sh \
|
|
|
|
&& apk add --no-cache su-exec bash tzdata \
|
|
|
|
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
|
2024-03-22 03:39:32 +00:00
|
|
|
&& echo "UTC" > /etc/timezone
|
2022-03-31 21:47:11 +00:00
|
|
|
|
2024-03-22 03:39:32 +00:00
|
|
|
ARG DEFAULT_CONFIG_DIR="/etc/clickhouse-keeper"
|
|
|
|
ARG DEFAULT_DATA_DIR="/var/lib/clickhouse-keeper"
|
|
|
|
ARG DEFAULT_LOG_DIR="/var/log/clickhouse-keeper"
|
|
|
|
RUN mkdir -p "${DEFAULT_DATA_DIR}" "${DEFAULT_LOG_DIR}" "${DEFAULT_CONFIG_DIR}" \
|
|
|
|
&& chown clickhouse:clickhouse "${DEFAULT_DATA_DIR}" \
|
|
|
|
&& chown root:clickhouse "${DEFAULT_LOG_DIR}" \
|
|
|
|
&& chmod ugo+Xrw -R "${DEFAULT_DATA_DIR}" "${DEFAULT_LOG_DIR}" "${DEFAULT_CONFIG_DIR}"
|
2022-03-31 21:47:11 +00:00
|
|
|
|
2024-03-24 05:07:52 +00:00
|
|
|
# /var/lib/clickhouse is necessary due to the current default configuration for Keeper
|
|
|
|
VOLUME "${DEFAULT_DATA_DIR}" /var/lib/clickhouse
|
2022-06-30 10:47:35 +00:00
|
|
|
EXPOSE 2181 10181 44444 9181
|
2022-03-31 21:47:11 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|