From 9505dab6998c5028845c9d40c32be1cf9bb26e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 2 Jan 2025 15:17:25 +0100 Subject: [PATCH] Fix `LegacyKeyValueFormat` deprecation in Dockerfiles > LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format --- .github/workflows/daemon.yml | 15 +++++++++++- .github/workflows/php.yml | 30 ++++++++++++++++++++++-- daemon/Dockerfile | 2 +- php/Dockerfile | 6 ++--- php/alpine/Dockerfile | 6 ++--- update.sh | 45 ++++++++++++++++++++++++++---------- 6 files changed, 82 insertions(+), 22 deletions(-) diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml index c56684c..41042bc 100644 --- a/.github/workflows/daemon.yml +++ b/.github/workflows/daemon.yml @@ -38,7 +38,20 @@ jobs: - name: Extract version from Dockerfile id: extract_version working-directory: ./${{ env.image }}/ - run: echo "version=$(awk '$1 == "ENV" && $2 == "TIDEWAYS_DAEMON_VERSION"{print $3}' Dockerfile)" >> $GITHUB_OUTPUT + run: | + echo "version=$(awk ' + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_DAEMON_VERSION") { + print a[2] + exit + } + } + } + env && !/\\$/ { env=0 } + ' Dockerfile)" >> $GITHUB_OUTPUT - uses: docker/build-push-action@v6 id: build diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index d1bc6dd..2887c8b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -38,7 +38,20 @@ jobs: - name: Extract version from Dockerfile id: extract_version working-directory: ./${{ env.image }}/ - run: echo "version=$(awk '$1 == "ENV" && $2 == "TIDEWAYS_PHP_VERSION"{print $3}' Dockerfile)" >> $GITHUB_OUTPUT + run: | + echo "version=$(awk ' + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_PHP_VERSION") { + print a[2] + exit + } + } + } + env && !/\\$/ { env=0 } + ' Dockerfile)" >> $GITHUB_OUTPUT - uses: docker/build-push-action@v6 id: build @@ -77,7 +90,20 @@ jobs: - name: Extract version from Dockerfile id: extract_version working-directory: ./${{ env.image }}/ - run: echo "version=$(awk '$1 == "ENV" && $2 == "TIDEWAYS_PHP_VERSION"{print $3}' Dockerfile)" >> $GITHUB_OUTPUT + run: | + echo "version=$(awk ' + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_PHP_VERSION") { + print a[2] + exit + } + } + } + env && !/\\$/ { env=0 } + ' Dockerfile)" >> $GITHUB_OUTPUT - uses: docker/build-push-action@v6 id: build diff --git a/daemon/Dockerfile b/daemon/Dockerfile index 7079f8a..66e15b8 100644 --- a/daemon/Dockerfile +++ b/daemon/Dockerfile @@ -20,7 +20,7 @@ COPY --chmod=0755 docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] -ENV TIDEWAYS_DAEMON_VERSION 1.9.28 +ENV TIDEWAYS_DAEMON_VERSION=1.9.28 RUN set -eux; \ export DEBIAN_FRONTEND="noninteractive"; \ diff --git a/php/Dockerfile b/php/Dockerfile index f7569ba..4fdcda2 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -4,9 +4,9 @@ LABEL org.opencontainers.image.source="https://github.com/tideways/container-ima COPY --chmod=0755 get-ext-path.php /tideways/ -ENV TIDEWAYS_PHP_VERSION 5.16.2 -ENV TIDEWAYS_PHP_SHA256_X64 6d22c193855646f12b992a97384144d0dd0ad3af8d44b9ac27be877a01586a1f -ENV TIDEWAYS_PHP_SHA256_ARM64 9d74e4d03946484ab46e9e3e1e5b37f9ea55e896381f9d03e883bf3377af1691 +ENV TIDEWAYS_PHP_VERSION=5.16.2 +ENV TIDEWAYS_PHP_SHA256_X64=6d22c193855646f12b992a97384144d0dd0ad3af8d44b9ac27be877a01586a1f +ENV TIDEWAYS_PHP_SHA256_ARM64=9d74e4d03946484ab46e9e3e1e5b37f9ea55e896381f9d03e883bf3377af1691 RUN set -eux; \ export DEBIAN_FRONTEND="noninteractive"; \ diff --git a/php/alpine/Dockerfile b/php/alpine/Dockerfile index 108a726..8b7bcce 100644 --- a/php/alpine/Dockerfile +++ b/php/alpine/Dockerfile @@ -4,9 +4,9 @@ LABEL org.opencontainers.image.source="https://github.com/tideways/container-ima COPY --chmod=0755 get-ext-path.php /tideways/ -ENV TIDEWAYS_PHP_VERSION 5.16.2 -ENV TIDEWAYS_PHP_SHA256_X64 14406730d552a4b5b3beec6474417ca041f4c931adc6dc46ae89db4187cb4b99 -ENV TIDEWAYS_PHP_SHA256_ARM64 8769953490659edeed77044fd83c9e2c203eedcaef4dc63cb426f74614c77ad8 +ENV TIDEWAYS_PHP_VERSION=5.16.2 +ENV TIDEWAYS_PHP_SHA256_X64=14406730d552a4b5b3beec6474417ca041f4c931adc6dc46ae89db4187cb4b99 +ENV TIDEWAYS_PHP_SHA256_ARM64=8769953490659edeed77044fd83c9e2c203eedcaef4dc63cb426f74614c77ad8 RUN set -eux; \ apk add --no-cache --virtual .build-deps \ diff --git a/update.sh b/update.sh index 671e0eb..e9cb9e9 100755 --- a/update.sh +++ b/update.sh @@ -7,9 +7,16 @@ versions="$(curl -fsSL 'https://app.tideways.io/api/current-versions')" TIDEWAYS_DAEMON_VERSION="$(echo "$versions" |jq -r '.daemon.version')" awk \ -v TIDEWAYS_DAEMON_VERSION="$TIDEWAYS_DAEMON_VERSION" \ - ' \ - $1 == "ENV" && $2 == "TIDEWAYS_DAEMON_VERSION"{$3 = TIDEWAYS_DAEMON_VERSION} \ - {print} \ + ' + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_DAEMON_VERSION") { $i = a[1] "=" TIDEWAYS_DAEMON_VERSION } + } + } + { print } + env && !/\\$/ { env=0 } ' \ < daemon/Dockerfile > daemon/Dockerfile.new mv -f daemon/Dockerfile.new daemon/Dockerfile @@ -19,11 +26,18 @@ awk \ -v "TIDEWAYS_PHP_VERSION=$TIDEWAYS_PHP_VERSION" \ -v "TIDEWAYS_PHP_SHA256_X64=$(curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-x86_64.tar.gz" |sha256sum |cut -d' ' -f1)" \ -v "TIDEWAYS_PHP_SHA256_ARM64=$(curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-arm64.tar.gz" |sha256sum |cut -d' ' -f1)" \ - ' \ - $1 == "ENV" && $2 == "TIDEWAYS_PHP_VERSION"{$3 = TIDEWAYS_PHP_VERSION} - $1 == "ENV" && $2 == "TIDEWAYS_PHP_SHA256_X64"{$3 = TIDEWAYS_PHP_SHA256_X64} \ - $1 == "ENV" && $2 == "TIDEWAYS_PHP_SHA256_ARM64"{$3 = TIDEWAYS_PHP_SHA256_ARM64} \ - {print} \ + ' + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_PHP_VERSION") { $i = a[1] "=" TIDEWAYS_PHP_VERSION } + if (a[1] == "TIDEWAYS_PHP_SHA256_X64") { $i = a[1] "=" TIDEWAYS_PHP_SHA256_X64 } + if (a[1] == "TIDEWAYS_PHP_SHA256_ARM64") { $i = a[1] "=" TIDEWAYS_PHP_SHA256_ARM64 } + } + } + { print } + env && !/\\$/ { env=0 } ' \ < php/Dockerfile > php/Dockerfile.new mv -f php/Dockerfile.new php/Dockerfile @@ -33,10 +47,17 @@ awk \ -v "TIDEWAYS_PHP_SHA256_X64=$(curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-alpine-x86_64.tar.gz" |sha256sum |cut -d' ' -f1)" \ -v "TIDEWAYS_PHP_SHA256_ARM64=$(curl -fsSL "https://tideways.s3.amazonaws.com/extension/${TIDEWAYS_PHP_VERSION}/tideways-php-${TIDEWAYS_PHP_VERSION}-alpine-arm64.tar.gz" |sha256sum |cut -d' ' -f1)" \ ' \ - $1 == "ENV" && $2 == "TIDEWAYS_PHP_VERSION"{$3 = TIDEWAYS_PHP_VERSION} \ - $1 == "ENV" && $2 == "TIDEWAYS_PHP_SHA256_X64"{$3 = TIDEWAYS_PHP_SHA256_X64} \ - $1 == "ENV" && $2 == "TIDEWAYS_PHP_SHA256_ARM64"{$3 = TIDEWAYS_PHP_SHA256_ARM64} \ - {print} \ + $1 == "ENV" { env=1 } + env { + for (i=1; i <= NF; i++) { + split($i, a, "="); + if (a[1] == "TIDEWAYS_PHP_VERSION") { $i = a[1] "=" TIDEWAYS_PHP_VERSION } + if (a[1] == "TIDEWAYS_PHP_SHA256_X64") { $i = a[1] "=" TIDEWAYS_PHP_SHA256_X64 } + if (a[1] == "TIDEWAYS_PHP_SHA256_ARM64") { $i = a[1] "=" TIDEWAYS_PHP_SHA256_ARM64 } + } + } + { print } + env && !/\\$/ { env=0 } ' \ < php/alpine/Dockerfile > php/alpine/Dockerfile.new mv -f php/alpine/Dockerfile.new php/alpine/Dockerfile