2022-03-30 22:14:28 +00:00
|
|
|
FROM ubuntu:20.04 AS glibc-donor
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
RUN arch=${TARGETARCH:-amd64} \
|
|
|
|
&& case $arch in \
|
|
|
|
amd64) rarch=x86_64 ;; \
|
|
|
|
arm64) rarch=aarch64 ;; \
|
|
|
|
esac \
|
|
|
|
&& ln -s "${rarch}-linux-gnu" /lib/linux-gnu
|
|
|
|
|
|
|
|
|
2020-10-28 12:58:38 +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
|
|
|
|
|
2022-03-30 22:14:28 +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.31.so /lib/
|
|
|
|
COPY --from=glibc-donor /etc/nsswitch.conf /etc/
|
2022-03-14 11:59:09 +00:00
|
|
|
COPY docker_related_config.xml /etc/clickhouse-server/config.d/
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
|
2022-03-30 22:14:28 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
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
|
|
|
|
|
2022-03-14 11:59:09 +00:00
|
|
|
# lts / testing / prestable / etc
|
|
|
|
ARG REPO_CHANNEL="stable"
|
2022-03-30 22:14:28 +00:00
|
|
|
ARG REPOSITORY="https://packages.clickhouse.com/tgz/${REPO_CHANNEL}"
|
2024-01-30 18:01:46 +00:00
|
|
|
ARG VERSION="24.1.1.2048"
|
2022-03-14 11:59:09 +00:00
|
|
|
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
|
2023-12-18 08:07:22 +00:00
|
|
|
ARG DIRECT_DOWNLOAD_URLS=""
|
2020-10-28 12:58:38 +00:00
|
|
|
|
2021-01-15 17:59:12 +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.
|
|
|
|
|
2022-03-30 22:14:28 +00:00
|
|
|
RUN arch=${TARGETARCH:-amd64} \
|
2023-12-18 08:07:22 +00:00
|
|
|
&& cd /tmp \
|
|
|
|
&& 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 \
|
|
|
|
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 | sed 's:/output/:/tmp/:' | sha512sum -c \
|
|
|
|
&& for file in *.tgz; do \
|
|
|
|
if [ -f "$file" ]; then \
|
|
|
|
echo "Unpacking $file"; \
|
|
|
|
tar xvzf "$file" --strip-components=1 -C /; \
|
|
|
|
fi \
|
2022-03-14 11:59:09 +00:00
|
|
|
; done \
|
|
|
|
&& rm /tmp/*.tgz /install -r \
|
|
|
|
&& addgroup -S -g 101 clickhouse \
|
2021-01-14 22:37:27 +00:00
|
|
|
&& adduser -S -h /var/lib/clickhouse -s /bin/bash -G clickhouse -g "ClickHouse server" -u 101 clickhouse \
|
2022-03-14 11:59:09 +00:00
|
|
|
&& mkdir -p /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server/config.d /etc/clickhouse-server/users.d /etc/clickhouse-client /docker-entrypoint-initdb.d \
|
2020-10-28 12:58:38 +00:00
|
|
|
&& chown clickhouse:clickhouse /var/lib/clickhouse \
|
|
|
|
&& chown root:clickhouse /var/log/clickhouse-server \
|
|
|
|
&& chmod +x /entrypoint.sh \
|
2022-04-16 22:14:27 +00:00
|
|
|
&& apk add --no-cache bash tzdata \
|
2021-03-23 10:48:28 +00:00
|
|
|
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
|
|
|
|
&& echo "UTC" > /etc/timezone \
|
2021-01-21 17:25:09 +00:00
|
|
|
&& chmod ugo+Xrw -R /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client
|
|
|
|
|
2021-01-22 14:28:36 +00:00
|
|
|
# we need to allow "others" access to clickhouse folder, because docker container
|
2021-01-21 17:25:09 +00:00
|
|
|
# can be started with arbitrary uid (openshift usecase)
|
2020-10-28 12:58:38 +00:00
|
|
|
|
|
|
|
EXPOSE 9000 8123 9009
|
|
|
|
|
|
|
|
VOLUME /var/lib/clickhouse \
|
|
|
|
/var/log/clickhouse-server
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|