Skip to content

Commit

Permalink
Merge pull request #10 from tideways/dockerfile-deprecated-env
Browse files Browse the repository at this point in the history
Fix `LegacyKeyValueFormat` deprecation in Dockerfiles
  • Loading branch information
edorian authored Jan 6, 2025
2 parents b7528cf + 9505dab commit c0a2e70
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 22 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/daemon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion daemon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
6 changes: 3 additions & 3 deletions php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
6 changes: 3 additions & 3 deletions php/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
45 changes: 33 additions & 12 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit c0a2e70

Please sign in to comment.