Skip to content

Commit 9d66e78

Browse files
committed
Merge #289 - Add SHA checksum when downloading a version
Signed-off-by: William Desportes <williamdes@wdes.fr>
2 parents c0b2ac2 + 85a642d commit 9d66e78

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

Dockerfile-alpine.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RUN set -ex; \
6161

6262
# Calculate download URL
6363
ENV VERSION %%VERSION%%
64+
ENV SHA256 %%SHA256%%
6465
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
6566

6667
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -83,6 +84,7 @@ RUN set -ex; \
8384
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
8485
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
8586
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
87+
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
8688
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8789
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8890
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \

Dockerfile-debian.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ RUN set -ex; \
6363

6464
# Calculate download URL
6565
ENV VERSION %%VERSION%%
66+
ENV SHA256 %%SHA256%%
6667
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
6768

6869
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -90,6 +91,7 @@ RUN set -ex; \
9091
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
9192
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
9293
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
94+
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
9395
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9496
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9597
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \

apache/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ RUN set -ex; \
6363

6464
# Calculate download URL
6565
ENV VERSION 5.0.2
66+
ENV SHA256 cbcc78d1499308d9329950fcba2ebaa84c559a934fe54efc027d459d8e4161c8
6667
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
6768

6869
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -90,6 +91,7 @@ RUN set -ex; \
9091
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
9192
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
9293
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
94+
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
9395
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9496
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9597
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \

fpm-alpine/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RUN set -ex; \
6161

6262
# Calculate download URL
6363
ENV VERSION 5.0.2
64+
ENV SHA256 cbcc78d1499308d9329950fcba2ebaa84c559a934fe54efc027d459d8e4161c8
6465
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
6566

6667
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -83,6 +84,7 @@ RUN set -ex; \
8384
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
8485
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
8586
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
87+
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
8688
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8789
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
8890
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \

fpm/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ RUN set -ex; \
6363

6464
# Calculate download URL
6565
ENV VERSION 5.0.2
66+
ENV SHA256 cbcc78d1499308d9329950fcba2ebaa84c559a934fe54efc027d459d8e4161c8
6667
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
6768

6869
LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \
@@ -90,6 +91,7 @@ RUN set -ex; \
9091
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
9192
curl -fsSL -o phpMyAdmin.tar.xz $URL; \
9293
curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \
94+
echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \
9395
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9496
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
9597
|| gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \

update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ declare -A base=(
2222
)
2323

2424
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
25+
sha256="$(curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/$latest/phpMyAdmin-$latest-all-languages.tar.xz.sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
2526

2627
for variant in apache fpm fpm-alpine; do
2728
template="Dockerfile-${base[$variant]}.template"
@@ -30,6 +31,7 @@ for variant in apache fpm fpm-alpine; do
3031
cp docker-entrypoint.sh "$variant/docker-entrypoint.sh"
3132
sed -ri -e '
3233
s/%%VERSION%%/'"$latest"'/;
34+
s/%%SHA256%%/'"$sha256"'/;
3335
s/%%VARIANT%%/'"$variant"'/;
3436
s/%%CMD%%/'"${cmd[$variant]}"'/;
3537
' "$variant/Dockerfile"

0 commit comments

Comments
 (0)