amazonlinux23 + alpine support

This commit is contained in:
Jason Swank
2024-01-16 18:39:00 +00:00
parent aa36dedffd
commit 08341301c1
5 changed files with 92 additions and 10 deletions

View File

@@ -1,8 +1,14 @@
#!/usr/bin/env -S just --working-directory . --justfile
image := "jswank/aws-cli"
tag := "al23"
n := "aws-cli"
# path to the cdk project on this host - default to the current working
# directory.
proj_path := invocation_directory()
proj := file_name(proj_path)
# Invoke the 'run' recipe
default: run
@@ -15,7 +21,12 @@ default: run
#
# Run an ephemeral container.
@run:
docker run -ti --userns=keep-id --rm {{image}}
podman run -ti --userns=keep-id -v {{proj_path}}:/home/cli/{{proj}} \
--workdir /home/cli/{{proj}} --rm \
--env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--env AWS_REGION=$AWS_REGION \
{{image}}:{{tag}}
# Usage: persist
#
@@ -27,19 +38,24 @@ default: run
# Run (or attach to) a persistent container
persist:
#!/bin/sh
if [ $(docker ps --all --filter name="^{{n}}$" -q | wc -l) -gt 0 ]; then
docker start -i -a {{n}}
if [ $(podman ps --all --filter name="^{{n}}$" -q | wc -l) -gt 0 ]; then
podman start -i -a {{n}}
else
docker run -ti --userns=keep-id --name {{n}} {{image}}
podman run -ti --userns=keep-id -v {{proj_path}}:/home/cli/{{proj}} \
--workdir /home/cli/{{proj}} --name {{n}} \
--env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
--env AWS_REGION=$AWS_REGION \
{{image}}:{{tag}}
fi
# Pull the latest version of the image
@pull:
docker pull {{image}} >/dev/null 2>&1
podman pull {{image}}:{{tag}} >/dev/null 2>&1
# Remove the persistent container
@clean:
docker rm -f {{n}} >/dev/null 2>&1
podman rm -f {{n}} >/dev/null 2>&1
# Usage: save [new_image_name]
#
@@ -54,7 +70,7 @@ persist:
#
# Save the running container as a new image
save i=image:
docker commit -q {{n}} {{i}} >/dev/null 2>&1
podman commit -q {{n}} {{i}} >/dev/null 2>&1
# Remove a running container, and run the default recipe
@restart: clean default