Skip to content

Commit d8f7c1f

Browse files
committed
[build] Fix build hook for DockerHub
1 parent 7103a25 commit d8f7c1f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

docker/hooks/build

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ set -ex
55
# as build argument. For more information on build hooks and environment
66
# variables, see: https://docs.docker.com/docker-hub/builds/advanced/
77

8-
TAG=${IMAGE_NAME##*:}
9-
if [[ $TAG == latest ]]; then
8+
# DOCKER_TAG can be : latest, ubuntu-20.04, v1.0.0, v1.0.0-ubuntu-20.04
9+
10+
if [[ $DOCKER_TAG =~ "^(latest|v[0-9]+\.[0-9]+\.[0-9]+)$" ]]; then
1011
TAG=debian-buster-slim
12+
else
13+
# Remove vX.X.X- suffix
14+
TAG=$(echo $DOCKER_TAG | sed 's/v[0-9]\+.[0-9]\+.[0-9]\+-//')
1115
fi
1216

1317
# Replace first '-' by ':'
18+
# ie, ubuntu-20.04 will be ubuntu:20.04 (image name)
1419
FROM=${TAG/-/:}
1520

1621
docker build . \

0 commit comments

Comments
 (0)