Skip to content

Commit 291bb14

Browse files
committed
The Dockerfile is reviewed by docker-official
`apt-get upgrade` shouldn't be executed during the build `apt-get clean` is a noop `gpg` should use batch and download key by full fingreprints The CI specific steps shouln't be presented in docker library Using `COPY --chmod` instead of two layers is not possible yet, but entrypoint.sh already contains +x bit in the git repo
1 parent 78af18a commit 291bb14

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

docker/server/Dockerfile.ubuntu

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM ubuntu:20.04
22

33
# see https://github.com/moby/moby/issues/4032#issuecomment-192327844
4+
# It could be removed after we move on a version 23:04+
45
ARG DEBIAN_FRONTEND=noninteractive
56

67
# ARG for quick switch to a given ubuntu mirror
78
ARG apt_archive="http://archive.ubuntu.com"
89

10+
# We shouldn't use `apt upgrade` to not change the upstream image. It's updated biweekly
11+
912
# user/group precreated explicitly with fixed uid/gid on purpose.
1013
# It is especially important for rootless containers: in that case entrypoint
1114
# can't do chown and owners of mounted volumes should be configured externally.
@@ -16,20 +19,21 @@ RUN sed -i "s|http://archive.ubuntu.com|${apt_archive}|g" /etc/apt/sources.list
1619
&& groupadd -r clickhouse --gid=101 \
1720
&& useradd -r -g clickhouse --uid=101 --home-dir=/var/lib/clickhouse --shell=/bin/bash clickhouse \
1821
&& apt-get update \
19-
&& apt-get upgrade -yq \
2022
&& apt-get install --yes --no-install-recommends \
2123
ca-certificates \
2224
locales \
2325
tzdata \
2426
wget \
25-
&& apt-get clean \
2627
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
2728

2829
ARG REPO_CHANNEL="stable"
2930
ARG REPOSITORY="deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb ${REPO_CHANNEL} main"
3031
ARG VERSION="24.4.1.2088"
3132
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
3233

34+
#docker-official-library:off
35+
# The part between `docker-official-library` tags is related to our builds
36+
3337
# set non-empty deb_location_url url to create a docker image
3438
# from debs created by CI build, for example:
3539
# docker build . --network host --build-arg version="21.4.1.6282" --build-arg deb_location_url="https://..." -t ...
@@ -80,19 +84,22 @@ RUN if [ -n "${single_binary_location_url}" ]; then \
8084
&& rm -rf /tmp/* ; \
8185
fi
8286

87+
# The rest is the same in the official docker and in our build system
88+
#docker-official-library:on
89+
8390
# A fallback to installation from ClickHouse repository
8491
RUN if ! clickhouse local -q "SELECT ''" > /dev/null 2>&1; then \
8592
apt-get update \
8693
&& apt-get install --yes --no-install-recommends \
8794
apt-transport-https \
88-
ca-certificates \
8995
dirmngr \
9096
gnupg2 \
9197
&& mkdir -p /etc/apt/sources.list.d \
9298
&& GNUPGHOME=$(mktemp -d) \
93-
&& GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring \
99+
&& GNUPGHOME="$GNUPGHOME" gpg --batch --no-default-keyring \
94100
--keyring /usr/share/keyrings/clickhouse-keyring.gpg \
95-
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754 \
101+
--keyserver hkp://keyserver.ubuntu.com:80 \
102+
--recv-keys 3a9ea1193a97b548be1457d48919f6bd2b48d754 \
96103
&& rm -rf "$GNUPGHOME" \
97104
&& chmod +r /usr/share/keyrings/clickhouse-keyring.gpg \
98105
&& echo "${REPOSITORY}" > /etc/apt/sources.list.d/clickhouse.list \
@@ -127,7 +134,6 @@ RUN mkdir /docker-entrypoint-initdb.d
127134

128135
COPY docker_related_config.xml /etc/clickhouse-server/config.d/
129136
COPY entrypoint.sh /entrypoint.sh
130-
RUN chmod +x /entrypoint.sh
131137

132138
EXPOSE 9000 8123 9009
133139
VOLUME /var/lib/clickhouse

0 commit comments

Comments
 (0)