Skip to content

Commit

Permalink
Add feature to remove cached icons when spinning down project
Browse files Browse the repository at this point in the history
The changes in this commit ensures that cached icons are removed from the server
so that changes made to the `net.unraid.docker.icon` are respected.
  • Loading branch information
arifer612 committed Jun 24, 2022
1 parent 276f8b2 commit 8d884be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/compose.manager/scripts/compose.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
#!/bin/bash

export HOME=/root
export DOCKER_JSON=/usr/local/emhttp/state/plugins/dynamix.docker.manager/docker.json
DOCKER_MANAGER=/usr/local/emhttp/state/plugins/dynamix.docker.manager
DOCKER_JSON=$DOCKER_MANAGER/docker.json
DOCKER_IMAGES=$DOCKER_MANAGER/images
UNRAID_IMAGES=/var/lib/docker/unraid/images

case $1 in

up)
docker compose -f "$2" -p "$3" ps -a |
awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' |
xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON
docker compose -f "$2" -p "$3" ps -a |
xargs -I {} find $DOCKER_IMAGES $UNRAID_IMAGES -name {}.png -delete
docker compose -f "$2" -p "$3" up -d 2>&1
;;

down)
docker compose -f "$2" -p "$3" ps -a |
awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' |
xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON
docker compose -f "$2" -p "$3" ps -a |
xargs -I {} find $DOCKER_IMAGES $UNRAID_IMAGES -name {}.png -delete
docker compose -f "$2" -p "$3" down 2>&1
;;

Expand Down

0 comments on commit 8d884be

Please sign in to comment.