Skip to content

Commit

Permalink
chore(electric): Tag Electric's Docker images with a minor version (#606
Browse files Browse the repository at this point in the history
)

This is an idiom in the Docker community that allows consumers of the
image to follow all versions of an image up until the next major
release.
  • Loading branch information
alco authored Nov 1, 2023
1 parent 3847bba commit c890fb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/electric/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,20 @@ CACHING_SETTINGS_ELECTRIC := --cache-to type=gha,mode=max,scope=${GITHUB_REF_NAM
CACHING_SETTINGS_WS_CLIENT := --cache-to type=gha,mode=max,scope=${GITHUB_REF_NAME}-ws-client --cache-from type=gha,scope=${GITHUB_REF_NAME}-ws-client
endif

# Cut off the patch component of the version and anything else that's trailing it,
# leaving only the leading X.Y parts of the version.
ELECTRIC_VERSION_MINOR := $(shell echo "${ELECTRIC_VERSION}" | awk -F. '{print $$1 "." $$2}')

docker-build-ci:
docker buildx build --load --build-arg ELECTRIC_VERSION=${ELECTRIC_VERSION} \
-t ${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION} \
-t electric:local-build ${CACHING_SETTINGS_ELECTRIC}\
.
ifeq (${TAG_AS_LATEST_AND_PUSH}, true)
docker tag "${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION}" "${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION_MINOR}"
docker tag "${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION}" "${ELECTRIC_IMAGE_NAME}:latest"
docker push "${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION}"
docker push "${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION_MINOR}"
docker push "${ELECTRIC_IMAGE_NAME}:latest"
endif

Expand All @@ -90,7 +96,9 @@ docker-build-ci-crossplatform:
docker buildx build --platform linux/arm64/v8,linux/amd64 --push \
--build-arg ELECTRIC_VERSION=${ELECTRIC_VERSION} \
-t ${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION} \
-t ${ELECTRIC_IMAGE_NAME}:latest .
-t ${ELECTRIC_IMAGE_NAME}:${ELECTRIC_VERSION_MINOR} \
-t ${ELECTRIC_IMAGE_NAME}:latest \
.

docker-clean:
ifneq ($(docker images -q electric:local-build 2> /dev/null), "")
Expand Down

0 comments on commit c890fb4

Please sign in to comment.