Compare commits

...

19 Commits

Author SHA1 Message Date
Jason Swank
cc4ae5b117 add CLI_ARGS to taskfile 2024-07-20 08:03:01 -04:00
bd2f8c93af update packages 2024-07-20 07:38:34 -04:00
b509e04f46 install just into build environment 2024-06-17 22:31:53 -04:00
f42565d3e7 revert sr.ht builds to just+image rather than task+manifest 2024-06-17 22:28:09 -04:00
f28f3e7a68 Merge branch '3' of git.sr.ht:~jswank/alpine-cli into 3 2024-06-10 22:29:18 -04:00
23719e952a .build.yml: add git tag to sources 2024-06-10 22:25:23 -04:00
afe1b6175c try task + build 2024-06-10 22:20:47 -04:00
f43022c3e4 lastest - taskfile, cli 2024-06-10 21:26:51 -04:00
74c7f1af1b add a Taskfile 2024-06-02 22:34:21 -04:00
187efe30ae Merge branch 'latest' of git.sr.ht:~jswank/alpine-cli into latest 2024-05-01 14:58:08 -04:00
Jason Swank
962c2a99d0 latest build 2023-12-10 01:17:08 +00:00
Jason Swank
ecefaf21b8 Merge branch '3' of git.sr.ht:~jswank/alpine-cli into 3 2023-12-10 01:06:24 +00:00
Jason Swank
e94d0c9bdb Update Dockerfile 2023-12-10 01:05:23 +00:00
abe50e0bff revert tag definition 2023-12-10 01:03:39 +00:00
5eee531c76 .build.yml: add git tag to sources 2023-12-10 01:03:39 +00:00
d9f04fda7a revert tag definition 2023-05-16 12:27:35 -04:00
15148c2f2d .build.yml: add git tag to sources 2023-05-16 11:36:04 -04:00
69ed89d421 build correct tag 2023-05-08 22:20:59 -04:00
ae5240316d fix tag typo 2023-05-08 22:17:48 -04:00
6 changed files with 46 additions and 12 deletions

View File

@ -1,4 +1,4 @@
image: alpine/edge image: alpine/latest
secrets: secrets:
- 0ee986ff-5686-43cd-ac3a-1fe5b2e5dd8f - 0ee986ff-5686-43cd-ac3a-1fe5b2e5dd8f
@ -6,7 +6,7 @@ secrets:
- 130adee5-3a8f-4035-8cad-e3d044be2961 - 130adee5-3a8f-4035-8cad-e3d044be2961
sources: sources:
- https://git.sr.ht/~jswank/alpine-cli - https://git.sr.ht/~jswank/alpine-cli#3
packages: packages:
- podman - podman
@ -24,6 +24,7 @@ tasks:
- build: | - build: |
cd alpine-cli cd alpine-cli
sudo --preserve-env just build sudo --preserve-env just build
# sudo --preserve-env go-task build
# publish the image using the just recipe # publish the image using the just recipe
# - set environment variables from the ~/.envdir directory. see # - set environment variables from the ~/.envdir directory. see
@ -33,5 +34,6 @@ tasks:
- publish: | - publish: |
cd alpine-cli cd alpine-cli
chpst -e ~/.envdir sudo --preserve-env just registry_pass_var=GH_PAT publish chpst -e ~/.envdir sudo --preserve-env just registry_pass_var=GH_PAT publish
chpst -e ~/.envdir sudo --preserve-env just registry=docker.io registry_pass_var=DH_PAT publish # chpst -e ~/.envdir sudo --preserve-env go-task publish
chpst -e ~/.envdir sudo --preserve-env just registry=quay.io registry_pass_var=QUAY_PAT publish # chpst -e ~/.envdir sudo --preserve-env just registry=docker.io registry_pass_var=DH_PAT publish
# chpst -e ~/.envdir sudo --preserve-env just registry=quay.io registry_pass_var=QUAY_PAT publish

View File

@ -1,4 +1,4 @@
FROM docker.io/library/alpine:latest FROM docker.io/library/alpine:3
LABEL org.opencontainers.image.title=jswank/alpine-cli \ LABEL org.opencontainers.image.title=jswank/alpine-cli \
org.opencontainers.image.description="A minimal image for running Linux CLI utilities" \ org.opencontainers.image.description="A minimal image for running Linux CLI utilities" \
@ -6,6 +6,8 @@ LABEL org.opencontainers.image.title=jswank/alpine-cli \
org.opencontainers.image.authors="Jason Swank" \ org.opencontainers.image.authors="Jason Swank" \
org.opencontainers.image.licenses=MIT org.opencontainers.image.licenses=MIT
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 \

View File

@ -12,7 +12,7 @@ images.
## Quickstart ## Quickstart
```console ```console
$ docker run -ti --rm ghcr.io/jswank/alpine-cli:3 $ docker run -ti --rm ghcr.io/jswank/alpine-cli
~ $ ^D ~ $ ^D
exit exit
@ -76,7 +76,7 @@ exit
Bonus - the same script could be used to start other containers: Bonus - the same script could be used to start other containers:
```console ```console
$ bin/cli image=alpine:latest $ bin/cli image=alpine:3
/ # ^D / # ^D
``` ```

31
Taskfile.yml Normal file
View File

@ -0,0 +1,31 @@
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
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
publish:
desc: publish the image
cmds:
- podman tag {{.IMAGE}}:{{.TAG}} {{.REGISTRY}}/{{.IMAGE}}:{{.ALT_TAG}}
- echo "${{.REGISTRY_PASS_VAR}}" | podman login {{.REGISTRY}} -u {{.REGISTRY_USER}} --password-stdin
- podman manifest push {{.REGISTRY}}/{{.IMAGE}}:{{.ALT_TAG}}
- podman logout {{.REGISTRY}}
vars:
REGISTRY_PASS_VAR: GH_PAT
REGISTRY: ghcr.io
REGISTRY_USER: jswank
ALT_TAG: '{{.TAG}}'

View File

@ -1,6 +1,6 @@
#!/usr/bin/env -S just --working-directory . --justfile #!/usr/bin/env -S just --working-directory . --justfile
image := "ghcr.io/jswank/alpine-cli:edge" image := "ghcr.io/jswank/alpine-cli:3"
n := "alpine-cli" n := "alpine-cli"
# Invoke the 'run' recipe # Invoke the 'run' recipe

View File

@ -11,12 +11,11 @@ registry_pass_var := "REGISTRY_PASSWORD"
# build a new image # build a new image
build flags="": build flags="":
podman manifest create {{image}}:{{tag}} podman build -t {{image}}:{{tag}} {{flags}} -f Dockerfile ctx
podman build --platform linux/amd64,linux/arm64 --manifest {{image}}:{{tag}} {{flags}} -f Dockerfile ctx
# publish the image # publish the image
publish alt_tag=tag: publish alt_tag=tag:
@ podman tag {{image}}:{{tag}} {{registry}}/{{image}}:{{alt_tag}} @ podman tag {{image}}:{{tag}} {{registry}}/{{image}}:{{alt_tag}}
@ echo "${{ registry_pass_var }}" | podman login {{registry}} -u {{registry_user}} --password-stdin @ echo "${{ registry_pass_var }}" | podman login {{registry}} -u {{registry_user}} --password-stdin
@ podman manifest push {{registry}}/{{image}}:{{alt_tag}} @ podman push {{registry}}/{{image}}:{{alt_tag}}
@ podman logout {{registry}} @ podman logout {{registry}}