Skip to content

Commit

Permalink
adds function to run and build mounted local imageˆ
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Gohlke committed Apr 17, 2024
1 parent c401532 commit 5becab7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tools/docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/bin/bash

function docker_build_mounted_run(){
local image="test-$RANDOM"
docker build -t "$image" .

if [ $# -eq 0 ]; then
docker run --rm -ti -v "$PWD":/src -w /src $image
else
# shellcheck disable=SC2068
docker run --rm -ti -v "$PWD":/src -w /src $image $@
fi
}

function docker_build_run(){
local image="test-$RANDOM"
docker build -t "$image" .
Expand Down Expand Up @@ -40,4 +52,4 @@ function docker_logs() {
__docker_containers
docker logs --timestamps $* "$CONTAINER_ID"
)
}
}

0 comments on commit 5becab7

Please sign in to comment.