Author: Adam <git@apiote.xyz>
add asgard
asgard/Dockerfile | 9 +++++++++ asgard/build.sh | 19 +++++++++++++++++++
diff --git a/asgard/Dockerfile b/asgard/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d48ef6776f462249aa22493fd71d5c8bad838b13 --- /dev/null +++ b/asgard/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine +RUN apk add git plan9port tar xz go openssh-client +WORKDIR /root +RUN mkdir .ssh +COPY ssh_key .ssh/id_ed25519 +COPY known_hosts .ssh/known_hosts +COPY build.sh build.sh +RUN chmod 755 build.sh +ENTRYPOINT ["./build.sh"] diff --git a/asgard/build.sh b/asgard/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..01fa06ab53777a2d5fae3c156cd27da09239f08a --- /dev/null +++ b/asgard/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -ex + +item="$1" + +git clone https://git.apiote.xyz/git/asgard.git +cd asgard +go build +tar cf asgard.txz templates/ asgard programs/ +commit=$(git show --pretty=oneline --abbrev-commit --name-only | head -n1 | cut -d ' ' -f 1) +timestamp=$(date '+%Y%m%dT%H%M') +scp asgard.txz deploy@host.containers.internal:toys/asgard/${item}/asgard_${timestamp}_${commit}.txz +ssh deploy@host.containers.internal "cp ~/toys/website/${item}/asgard_${timestamp}_${commit}.txz /tmp/asgard.txz" +ssh deploy@host.containers.internal "chmod a+rwX /tmp/asgard.txz" +ssh deploy@host.containers.internal "doas -u www cp /tmp/asgard.txz /var/www/asgard" +ssh deploy@host.containers.internal "rm /tmp/asgard.txz" +ssh deploy@host.containers.internal "doas -u www tar xavf /var/www/asgard/asgard.txz -C /var/www/asgard/" +ssh deploy@host.containers.internal "doas -u www doas /etc/init.d/asgard restart"