37 lines
842 B
Makefile
37 lines
842 B
Makefile
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
|
|
|
|
# publish the image
|
|
publish:
|
|
@ echo $GH_PAT | podman login ghcr.io -u jswank --password-stdin >/dev/null 2>&1
|
|
podman push {{image}}
|
|
@ podman logout ghcr.io
|
|
|