Build docker images using the Dockerfile for the corresponding tag (#4008)

changelog_begin

- [DAML SDK] Docker images for this release and releases in the future
are built using the Dockerfile of the corresponding git tag and are
therefore stable. Previously, they were updated whenever the
Dockerfile changed.

changelog_end
This commit is contained in:
Moritz Kiefer 2020-01-13 11:53:38 +01:00 committed by GitHub
parent 6bc00da1e2
commit e2df7e7ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,15 +62,16 @@ jobs:
RELEASES=$(curl https://api.github.com/repos/digital-asset/daml/releases -s | jq -r '. | map(select(.prerelease == false)) | map(.tag_name)[]')
DIR=$(pwd)
VERSIONS=$(curl 'https://hub.docker.com/v2/repositories/digitalasset/daml-sdk/tags/?page_size=10000' -s)
DOCKERFILE_CHANGE_TIME=$(date -uIs -d $(git log -1 --format="%cI" -- ci/docker/daml-sdk/Dockerfile))
# Our docker tags should be stable. Therefore, we only build the image if it has not already
# been built before and we checkout the Dockerfile for the release tag.
# We do not update docker images for older releases so only docker images for SDK releases
# >= 0.13.43 are built this way.
for version in $(echo $RELEASES | sed -e 's/ /\n/g'); do
git checkout "$version"
LAST_UPDATE=$(echo $VERSIONS | jq -r '.results[] | select(.name == "'${version#v}'") | .last_updated')
if [[ -n "$LAST_UPDATE" && "$LAST_UPDATE" > "$DOCKERFILE_CHANGE_TIME" ]]; then
echo "${version#v} already exists and is up to date, skipping."
if [[ -n "$LAST_UPDATE" ]]; then
echo "${version#v} already exists, skipping."
else
if [[ -n "$LAST_UPDATE" ]]; then
echo "${version#v} already exists but Dockerfile has changed; rebuilding..."
fi
echo "Building version ${version#v}..."
cd ci/docker/daml-sdk
docker build -t digitalasset/daml-sdk:${version#v} --build-arg VERSION=${version#v} .