Skip to content

Conversation

@arne-kroeger
Copy link

This commit adds an option to run the deploy only if the referenced image has an update from remote.

This can be used to minimize load if update not necessary or script is running in crons.

@c4710n
Copy link

c4710n commented Oct 13, 2023

This would be more solid by comparing docker config --hash output and com.docker.compose.config-hash container label.

Two related links:

container_id=$(docker ps --filter "label=com.docker.compose.service=$SERVICE" --format "{{.ID}}")

old_image_id=$(docker inspect --format='{{.Image}}' "$container_id")
new_image_id=$(docker manifest inspect "$image_name" | jq -r '.config.digest')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To loose dependency on jq this line should be:

new_image_id=$(docker inspect "$image_name" --format "{{.Id}}")


checkForUpdates() {
if ! command -v jq > /dev/null 2>&1; then
echo "jq is required for update-only"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to not depend on jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants