- Release script added to tag in both git and docker
This commit is contained in:
23
docker/release_and_tag_eveai.sh
Normal file → Executable file
23
docker/release_and_tag_eveai.sh
Normal file → Executable file
@@ -31,24 +31,25 @@ fi
|
|||||||
# Path to your docker-compose file
|
# Path to your docker-compose file
|
||||||
DOCKER_COMPOSE_FILE="compose_dev.yaml"
|
DOCKER_COMPOSE_FILE="compose_dev.yaml"
|
||||||
|
|
||||||
# Get all the services defined in the docker-compose file
|
# Get all the images defined in docker-compose
|
||||||
SERVICES=$(docker-compose -f $DOCKER_COMPOSE_FILE config --services)
|
IMAGES=$(docker compose -f $DOCKER_COMPOSE_FILE config | grep 'image:' | awk '{ print $2 }')
|
||||||
|
|
||||||
# Tag and push images for all services that belong to your Docker account
|
# Start tagging only relevant images
|
||||||
for SERVICE in $SERVICES; do
|
for DOCKER_IMAGE in $IMAGES; do
|
||||||
DOCKER_IMAGE="your-docker-repo/$SERVICE"
|
# Check if the image belongs to your Docker account and ends with :latest
|
||||||
|
if [[ $DOCKER_IMAGE == $DOCKER_ACCOUNT* && $DOCKER_IMAGE == *:latest ]]; then
|
||||||
|
# Remove the ":latest" tag to use the base image name
|
||||||
|
BASE_IMAGE=${DOCKER_IMAGE%:latest}
|
||||||
|
|
||||||
# Check if the image starts with your Docker account name
|
echo "Tagging Docker image: $BASE_IMAGE with version: $RELEASE_VERSION"
|
||||||
if [[ $DOCKER_IMAGE == $DOCKER_ACCOUNT* ]]; then
|
|
||||||
echo "Tagging Docker image for service: $SERVICE with version: $RELEASE_VERSION"
|
|
||||||
|
|
||||||
# Tag the 'latest' image with the new release version
|
# Tag the 'latest' image with the new release version
|
||||||
docker tag $DOCKER_IMAGE:latest $DOCKER_IMAGE:$RELEASE_VERSION
|
docker tag $DOCKER_IMAGE $BASE_IMAGE:$RELEASE_VERSION
|
||||||
|
|
||||||
# Push the newly tagged image to Docker Hub
|
# Push the newly tagged image to Docker Hub
|
||||||
docker push $DOCKER_IMAGE:$RELEASE_VERSION
|
docker push $BASE_IMAGE:$RELEASE_VERSION
|
||||||
else
|
else
|
||||||
echo "Skipping service: $SERVICE (not part of Docker account $DOCKER_ACCOUNT)"
|
echo "Skipping image: $DOCKER_IMAGE (not part of $DOCKER_ACCOUNT or not tagged as latest)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user