Files
alpine-cli/Taskfile.yml
2026-01-10 14:10:09 +00:00

52 lines
1.8 KiB
YAML

version: '3'
env:
IMAGE: jswank/alpine-cli
NAME: alpine-cli
vars:
TAG:
sh: 'grep ^FROM Dockerfile | cut -d: -f2'
tasks:
default:
cmds:
- task: build
build:
desc: build a new image; use CLI_ARGS to pass additional arguments (build -- --no-cache).
cmds:
- (podman manifest exists {{.IMAGE}}:{{.TAG}} && podman manifest rm {{.IMAGE}}:{{.TAG}}) || true
- podman manifest create {{.IMAGE}}:{{.TAG}}
- podman build {{.CLI_ARGS}} --platform linux/amd64,linux/arm64 --manifest {{.IMAGE}}:{{.TAG}} {{.CLI_ARGS}} -f Dockerfile ctx
- |
DIGESTS=$(podman manifest inspect {{.IMAGE}}:{{.TAG}} | jq -r '.manifests[].digest')
for DIGEST in $DIGESTS; do
echo "Annotating digest: $DIGEST"
podman manifest annotate \
--annotation org.opencontainers.image.description="A minimal image for running Linux CLI utilities" \
--annotation org.opencontainers.image.url=https://git.sr.ht/~jswank/alpine-cli \
--annotation org.opencontainers.image.title=jswank/alpine-cli \
{{.IMAGE}}:{{.TAG}} $DIGEST
done
publish:
desc: publish the image with the default tag, 'current', and 'latest'
cmds:
- task: _publish
- task: _publish
vars:
ALT_TAG: 'latest'
_publish:
desc: publish the image
internal: true
cmds:
- podman tag {{.IMAGE}}:{{.TAG}} {{.REGISTRY}}/{{.IMAGE}}:{{default .TAG .ALT_TAG}}
- echo "${{.REGISTRY_PASS_VAR}}" | podman login {{.REGISTRY}} -u {{.REGISTRY_USER}} --password-stdin
- podman manifest push {{.REGISTRY}}/{{.IMAGE}}:{{default .TAG .ALT_TAG}}
- podman logout {{.REGISTRY}}
vars:
REGISTRY_PASS_VAR: GH_PAT
REGISTRY: ghcr.io
REGISTRY_USER: jswank