Assigning version numbers based on commit count for simplicity
#!/usr/bin/env zsh
image_name=ytyng/my-docker-image
image_tag=1.11.$(git rev-list --count HEAD)
#!/usr/bin/env zsh
cd "$(dirname $0)" || exit
. ./config.sh
cd ..
docker build --platform linux/amd64 \
--ssh default -t ${image_name}:${image_tag} \
--build-arg IMAGE_TAG=${image_tag} \
-f docker/Dockerfile .
docker tag ${image_name}:${image_tag} ${image_name}:latest
FROM ...
...
ARG IMAGE_TAG='-'
RUN echo ${IMAGE_TAG} > /app/VERSION.txt
Comments