woodpecker: use apko to master a custom base image for the workload
ci/woodpecker/push/woodpecker Pipeline was successful Details

main
Ariadne Conill 2022-08-04 19:46:30 -05:00
parent dcdf2c13b1
commit 508ba2fadb
2 changed files with 33 additions and 9 deletions

View File

@ -1,20 +1,32 @@
pipeline:
deploy:
image: distroless.dev/alpine-base:latest
apko-image:
image: distroless.dev/apko:latest
commands:
- |
- echo $REGISTRY_SECRET | apko login --username ariadne --password-stdin gitea.treehouse.systems
- apko publish --arch $(uname -m) apko.yaml gitea.treehouse.systems/ariadne/ariadne.space-hugo:latest
secrets: [REGISTRY_SECRET]
deploy:
image: gitea.treehouse.systems/ariadne/ariadne.space-hugo:latest
commands:
# build the new site
- hugo
# fetch the old newswire
- curl -s https://ariadne.space/newswire.txt > oldnewswire.txt
# set up the SSH deployment key and upload the site
- |
mkdir $HOME/.ssh
echo "$SSH_KEY">$HOME/.ssh/id_ed25519
echo "$SSH_KNOWN_HOSTS">$HOME/.ssh/known_hosts
chown 600 $HOME/.ssh/id_ed25519
- echo '' >>/etc/apk/repositories
- echo 'https://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
- apk add hugo rsync openssh-client go git curl
- hugo
- wget -O oldnewswire.txt https://ariadne.space/newswire.txt
- rsync -avzHAX public/ kaniini@ariadne.space:public/
rsync -avHAX public/ kaniini@ariadne.space:public/
# if the newswire has changed, publish the new one.
- |
cmp oldnewswire.txt public/newswire.txt || \
curl -s -H "Authorization: Bearer $MASTODON_SECRET" -F "status=$(cat public/newswire.txt)" \
https://social.treehouse.systems/api/v1/statuses
secrets: [SSH_KEY, SSH_KNOWN_HOSTS, MASTODON_SECRET]

12
apko.yaml Normal file
View File

@ -0,0 +1,12 @@
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
- https://dl-cdn.alpinelinux.org/alpine/edge/community
packages:
- alpine-base
- curl
- go
- git
- hugo
- openssh-client
- rsync