Compare commits

...

7 Commits

Author SHA1 Message Date
Jason Swank
a23415c69a update direnv setup 2026-01-23 18:23:08 +00:00
Jason Swank
9d35f280dd add direnv hook 2026-01-20 15:33:39 +00:00
Jason Swank
92a48b1628 add direnv 2026-01-20 15:28:00 +00:00
Jason Swank
b152fc3e7a tag image 3 & latest 2026-01-10 14:10:09 +00:00
Jason Swank
97b420972b ensure jq is installed 2026-01-10 14:00:04 +00:00
Jason Swank
ea2cb2a7ae fix annotations 2026-01-10 13:58:30 +00:00
Jason Swank
c7ebf79dc3 3 2026-01-10 02:46:34 +00:00
8 changed files with 39 additions and 38 deletions

View File

@@ -17,6 +17,7 @@ packages:
- qemu-openrc - qemu-openrc
- qemu-modules - qemu-modules
- qemu-aarch64 - qemu-aarch64
- jq
tasks: tasks:
- prep: | - prep: |

View File

@@ -1,18 +1,12 @@
FROM docker.io/library/alpine:3 FROM docker.io/library/alpine:3
LABEL org.opencontainers.image.title=jswank/alpine-cli \
org.opencontainers.image.description="A minimal image for running Linux CLI utilities" \
org.opencontainers.image.url=https://git.sr.ht/~jswank/alpine-cli \
org.opencontainers.image.authors="Jason Swank" \
org.opencontainers.image.licenses=MIT
RUN apk --no-cache update RUN apk --no-cache update
RUN apk -U --no-cache add \ RUN apk -U --no-cache add \
doas doas-sudo-shim \ doas doas-sudo-shim \
bash less openvi \ bash less openvi \
coreutils grep gawk perl \ coreutils grep gawk perl \
curl bind-tools curl direnv bind-tools
RUN adduser -h /home/cli -s /bin/bash -D cli cli && \ RUN adduser -h /home/cli -s /bin/bash -D cli cli && \
addgroup cli wheel && \ addgroup cli wheel && \

View File

@@ -23,9 +23,8 @@ exit
## More Info ## More Info
The image is based on *alpine:3*, with a small amount of additional The image is based on *alpine:3* with a small amount of additional setup/installation.
setup/installation done. See the [Dockerfile](Dockerfile) and [ctx/home](ctx) See the [Dockerfile](Dockerfile) and [ctx/home](ctx) for the specifics.
for the specifics.
- Some basic utilities are installed for interative and script-based shell usage - Some basic utilities are installed for interative and script-based shell usage
- A user is created with sudo (`-u root`) access. - A user is created with sudo (`-u root`) access.
@@ -38,9 +37,9 @@ See ghcr.io/jswank/alpine-cli for current available images.
## Helper Script ## Helper Script
A helper script, using [casey/just](https://github.com/casey/just') is in [bin/cli](./bin/cli) is a helper script using
[bin/cli](bin/cli). It can be used to quickly start an ephemeral (or [casey/just](https://github.com/casey/just'). It can be used to quickly start an
persistent) container. ephemeral (or persistent) container.
```console ```console
$ bin/cli help $ bin/cli help

View File

@@ -18,14 +18,20 @@ tasks:
- (podman manifest exists {{.IMAGE}}:{{.TAG}} && podman manifest rm {{.IMAGE}}:{{.TAG}}) || true - (podman manifest exists {{.IMAGE}}:{{.TAG}} && podman manifest rm {{.IMAGE}}:{{.TAG}}) || true
- podman manifest create {{.IMAGE}}:{{.TAG}} - podman manifest create {{.IMAGE}}:{{.TAG}}
- podman build {{.CLI_ARGS}} --platform linux/amd64,linux/arm64 --manifest {{.IMAGE}}:{{.TAG}} {{.CLI_ARGS}} -f Dockerfile ctx - 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: publish:
desc: publish the image with the default tag, 'current', and 'latest' desc: publish the image with the default tag, 'current', and 'latest'
cmds: cmds:
- task: _publish - task: _publish
- task: _publish
vars:
ALT_TAG: 'current'
- task: _publish - task: _publish
vars: vars:
ALT_TAG: 'latest' ALT_TAG: 'latest'

View File

@@ -0,0 +1,4 @@
# Source library files in alphabetical order
for lib in ~/.config/direnv/lib/*.sh; do
[[ -f "$lib" ]] && source "$lib"
done

View File

@@ -0,0 +1,16 @@
# Exports a Podman / Docker secret as an environment variable
export-secret() {
local name="$1"
local file="/run/secrets/${name}"
if [[ ! -f "$file" ]]; then
printf "secret file not found: %s\n" $file >&2
return 1
fi
# Read first line, remove trailing spaces/tabs, convert nulls to newlines
local value
value=$(head -n1 "$file" | sed 's/[ \t]*$//' | tr '\0' '\n')
export "${name}=${value}"
}

View File

@@ -6,3 +6,5 @@ export LESS=RX # R for ANSI color sequences, X to not clear screen on exit
export TMPDIR=/var/tmp export TMPDIR=/var/tmp
export PS1="\w $ " export PS1="\w $ "
export PATH=${PATH}:~/.local/bin export PATH=${PATH}:~/.local/bin
eval "$(direnv hook bash)"

View File

@@ -1,21 +0,0 @@
set dotenv-load
tag := `grep ^FROM Dockerfile | cut -d: -f2`
image := "jswank/alpine-cli"
registry := "ghcr.io"
registry_user := "jswank"
# this environment variable will be passed to podman login as the password
registry_pass_var := "REGISTRY_PASSWORD"
# build a new image
build flags="":
podman build -t {{image}}:{{tag}} {{flags}} -f Dockerfile ctx
# publish the image
publish alt_tag=tag:
@ podman tag {{image}}:{{tag}} {{registry}}/{{image}}:{{alt_tag}}
@ echo "${{ registry_pass_var }}" | podman login {{registry}} -u {{registry_user}} --password-stdin
@ podman push {{registry}}/{{image}}:{{alt_tag}}
@ podman logout {{registry}}