Separate run orchestration from build orchestration
This commit is contained in:
parent
ac0aaec80d
commit
31a5443055
26
cli
Executable file
26
cli
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env -S just --working-directory . --justfile
|
||||
|
||||
image := "ghcr.io/jswank/alpine-cli:latest"
|
||||
n := "alpine-cli"
|
||||
|
||||
# get a bash shell on a temporary container using {{image}}
|
||||
all: run
|
||||
|
||||
# get a bash shell on a temporary container using {{image}}
|
||||
run:
|
||||
@ docker run -ti --rm {{image}}
|
||||
|
||||
# run (or attach to) a perisent container {{n}}
|
||||
persist:
|
||||
#!/bin/sh
|
||||
already_running=$(docker ps --all --filter name={{n}} --format=json | wc -l )
|
||||
if [[ $already_running -gt 0 ]]; then
|
||||
docker start -i {{n}}
|
||||
else
|
||||
docker run -ti --name {{n}} {{image}}
|
||||
fi
|
||||
|
||||
# remove the persistent image
|
||||
clean:
|
||||
@ docker rm -f {{n}} >/dev/null 2>&1
|
||||
|
||||
21
justfile
21
justfile
@ -3,27 +3,6 @@ set dotenv-load
|
||||
image := "ghcr.io/jswank/alpine-cli:latest"
|
||||
n := "alpine-cli"
|
||||
|
||||
# get a bash shell on a temporary container using {{image}}
|
||||
all: run
|
||||
|
||||
# get a bash shell on a temporary container using {{image}}
|
||||
run:
|
||||
@ docker run -ti --rm {{image}}
|
||||
|
||||
# run (or attach to) a perisent container {{n}}
|
||||
persist:
|
||||
#!/bin/sh
|
||||
already_running=$(docker ps --all --filter name={{n}} --format=json | wc -l )
|
||||
if [[ $already_running -gt 0 ]]; then
|
||||
docker start -i {{n}}
|
||||
else
|
||||
docker run -ti --name {{n}} {{image}}
|
||||
fi
|
||||
|
||||
# remove the persistent image
|
||||
clean:
|
||||
@ docker rm -f {{n}} >/dev/null 2>&1
|
||||
|
||||
# build a new image
|
||||
build:
|
||||
podman build -t {{image}} -f Dockerfile ./ctx
|
||||
|
||||
Loading…
Reference in New Issue
Block a user