Skip to content

Commit

Permalink
watch-serve: Remove containers after use
Browse files Browse the repository at this point in the history
Add the `--rm` flag to automatically delete the containers after they
have been used. The script won't restart existing containers anyways, so
there is no point in keeping them. It will only fill up the users disk.
  • Loading branch information
har7an committed Mar 1, 2022
1 parent 41f5594 commit 3e51fd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions watch-serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ if $(_exists podman); then
echo "Using '$CRT' as container runtime"

$CRT build --tag "$CONTAINER_NAME" -f Containerfile
$CRT run --userns keep-id --user "$(id -u):$(id -g)" -v "$PWD:$PWD:z" -w "$PWD" -p 1313:1313 $CONTAINER_NAME
$CRT run --rm -it --userns keep-id --user "$(id -u):$(id -g)" -v "$PWD:$PWD:z" -w "$PWD" -p 1313:1313 $CONTAINER_NAME

elif $(_exists docker); then
CRT="$(which docker)"
echo "Using '$CRT' as container runtime"

$CRT build --tag "$CONTAINER_NAME" <Containerfile
$CRT run --user "$(id -u):$(id -g)" -v "$PWD:$PWD" -w "$PWD" -p 1313:1313 $CONTAINER_NAME
$CRT run --rm -it --user "$(id -u):$(id -g)" -v "$PWD:$PWD" -w "$PWD" -p 1313:1313 $CONTAINER_NAME

else
echo "You must have installed either of:"
Expand Down

0 comments on commit 3e51fd9

Please sign in to comment.