blueprints.git

commit a63cf58583b2aa6a251efa89682a993a007482ee

Author: Adam <git@apiote.xyz>

toymaker

 toymaker/Dockerfile | 9 +++++++++
 toymaker/build.sh | 19 +++++++++++++++++++


diff --git a/toymaker/Dockerfile b/toymaker/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..456821b860ac70fa697645d72432e0bbb2efd392
--- /dev/null
+++ b/toymaker/Dockerfile
@@ -0,0 +1,9 @@
+FROM alpine
+RUN apk add git tar xz openssh-client shellcheck
+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/toymaker/build.sh b/toymaker/build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5112af1a696161290ae8a5ae2799eb67d67efea7
--- /dev/null
+++ b/toymaker/build.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -ex
+
+toy="toymaker"
+item="$1"
+
+git clone https://git.apiote.xyz/git/${toy}.git
+cd ${toy}
+shellcheck *.sh templates/*
+tar cf ${toy}.txz build_images.sh get.sh password.sh toymaker.sh start.sh templates/ log_parser.awk
+commit=$(git show --pretty=oneline --abbrev-commit --name-only | head -n1 | cut -d ' ' -f 1)
+timestamp=$(date '+%Y%m%dT%H%M')
+scp ${toy}.txz deploy@host.containers.internal:toys/${toy}/${item}/${toy}_${timestamp}_${commit}.txz
+ssh deploy@host.containers.internal "cp ~/toys/${toy}/${item}/${toy}_${timestamp}_${commit}.txz ~/${toy}.txz"
+ssh deploy@host.containers.internal "tar xavf ${toy}.txz"
+ssh deploy@host.containers.internal "rm ${toy}.txz"
+# ssh deploy@host.containers.internal "doas /etc/init.d/${toy} stop"
+# ssh deploy@host.containers.internal "doas /etc/init.d/${toy} start"