containers: use ceph/ceph as our base image

First off, ceph is no longer using docker hub for the canonical image
hosting. We have also been recommended to use ceph/ceph instead of
ceph/daemon-base. Thus we switch to 'quay.io/ceph/ceph'.

However, ceph/ceph doesn't use codenames for tags so we also have to use
version number tags. These are set as build args now. To retain
compatibility with the way we were working previously we have add a
best-effort "assertion" to ensure the code name we provide matches with
the codename embedded in the base image.

While working on this I discovered that our previous build args were
probably not working as intended, but only by accident. See:
https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
This is why we now name our build arg GO_CEPH_VERSION and it is located
after the 'FROM' line.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-08-24 10:45:24 -04:00 committed by mergify[bot]
parent 1adc3bac8b
commit cf6de4b12d

View File

@ -1,9 +1,18 @@
ARG CEPH_VERSION
FROM ceph/daemon-base:latest-${CEPH_VERSION:-octopus}
ARG CEPH_IMG=quay.io/ceph/ceph
ARG CEPH_TAG=v16
FROM ${CEPH_IMG}:${CEPH_TAG}
ENV CEPH_VERSION=${CEPH_VERSION:-octopus}
# A CEPH_VERSION env var is already set in the base image.
# We save our build arg as GO_CEPH_VERSION and later ensure that
# the values agree to ensure we're building what we meant to build.
ARG CEPH_TAG
ARG GO_CEPH_VERSION
ENV GO_CEPH_VERSION=${GO_CEPH_VERSION:-$CEPH_VERSION} \
CEPH_TAG=${CEPH_TAG}
RUN true && \
echo "Check: [ ${CEPH_VERSION} = ${GO_CEPH_VERSION} ]" && \
[ "${CEPH_VERSION}" = "${GO_CEPH_VERSION}" ] && \
yum update -y && \
cv="$(rpm -q --queryformat '%{version}-%{release}' ceph-common)" && \
yum install -y \