27 lines
641 B
Plaintext
Executable File
27 lines
641 B
Plaintext
Executable File
#!/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
|
|
|