Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USER" --password-stdin
docker pull "$IMAGE"

# Tear down the currently running container (if any).
docker stop ghcr.io/dev-chat/muzzle:latest 2>/dev/null || true
docker rm ghcr.io/dev-chat/muzzle:latest 2>/dev/null || true
# Tear down any running containers from this image.
docker stop $(docker ps -q --filter ancestor="$IMAGE") 2>/dev/null || true
docker rm $(docker ps -aq --filter ancestor="$IMAGE") 2>/dev/null || true
Comment on lines 59 to +63
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

docker pull "$IMAGE" updates the local :latest tag before you query containers by --filter ancestor="$IMAGE". Since ancestor is resolved to an image ID, this can fail to match (and therefore not stop/remove) containers that were started from the previous :latest image. Consider capturing the container IDs to stop/remove before pulling, or stop/remove by a stable container name/label instead of the ancestor filter.

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +63
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

If there are no matching containers, the command substitutions expand to empty and the runner executes docker stop / docker rm with no arguments (relying on || true). It would be cleaner and less noisy to guard on a non-empty container ID list (or use xargs -r) so Docker isn’t invoked with an empty argument list.

Suggested change
docker stop $(docker ps -q --filter ancestor="$IMAGE") 2>/dev/null || true
docker rm $(docker ps -aq --filter ancestor="$IMAGE") 2>/dev/null || true
CONTAINERS="$(docker ps -q --filter ancestor="$IMAGE")"
if [ -n "$CONTAINERS" ]; then
docker stop $CONTAINERS 2>/dev/null || true
fi
CONTAINERS_ALL="$(docker ps -aq --filter ancestor="$IMAGE")"
if [ -n "$CONTAINERS_ALL" ]; then
docker rm $CONTAINERS_ALL 2>/dev/null || true
fi

Copilot uses AI. Check for mistakes.

# Hand off to your existing startup script which handles volume
# mounts and env var injection.
Expand Down
Loading