Author: Adam <git@apiote.xyz>
website
website/Dockerfile | 9 +++++++++ website/build.sh | 19 +++++++++++++++++++
diff --git a/website/Dockerfile b/website/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d48ef6776f462249aa22493fd71d5c8bad838b13 --- /dev/null +++ b/website/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/website/build.sh b/website/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..7603ce73d2e2b9da2838079ca1d4e161b0e3afde --- /dev/null +++ b/website/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -ex + +item="$1" + +git clone https://git.apiote.xyz/git/website.git +cd website +go build +tar cf website.txz static/ templates/ website programs/ +commit=$(git show --pretty=oneline --abbrev-commit --name-only | head -n1 | cut -d ' ' -f 1) +timestamp=$(date '+%Y%m%dT%H%M') +scp website.txz deploy@host.containers.internal:toys/website/${item}/website_${timestamp}_${commit}.txz +ssh deploy@host.containers.internal "cp ~/toys/website/${item}/website_${timestamp}_${commit}.txz /tmp/website.txz" +ssh deploy@host.containers.internal "chmod a+rwX /tmp/website.txz" +ssh deploy@host.containers.internal "doas -u www cp /tmp/website.txz /var/www/website" +ssh deploy@host.containers.internal "rm /tmp/website.txz" +ssh deploy@host.containers.internal "doas -u www tar xavf /var/www/website/website.txz -C /var/www/website/" +ssh deploy@host.containers.internal "doas -u www doas /etc/init.d/website restart"