From 4d4a46f1679bf7cac4dcfbc0221ae01b6e4a59ff Mon Sep 17 00:00:00 2001 From: _ <> Date: Mon, 9 Nov 2020 01:06:53 +0000 Subject: [PATCH] :whale: --- .dockerignore | 1 + .gitignore | 2 ++ build-and-minimize.bash | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100755 build-and-minimize.bash diff --git a/.dockerignore b/.dockerignore index a26b144..16e1d8d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ /config +/ptth_latest.tar.gz /target diff --git a/.gitignore b/.gitignore index d4996e0..932b8d8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,7 @@ /*.tar.gz /ptth_server.toml /ptth_relay.toml +/ptth_build_L6KLMVS6/ /target /test + diff --git a/build-and-minimize.bash b/build-and-minimize.bash new file mode 100755 index 0000000..155ec58 --- /dev/null +++ b/build-and-minimize.bash @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Use: ./build-and-minimize.bash + +# Makes a docker image, saves it as .tar, unpacks the tar, removes +# the base Debian layer, and repacks it so I can upload to servers a little +# faster. + +TEMP_GIBBERISH="ptth_build_L6KLMVS6" +TEMP_TAR="$TEMP_GIBBERISH/ptth.tar" +UPLOADABLE_TAR="$PWD/ptth_latest.tar.gz" + +# This is magic and will need to be updated whenever we update the +# Debian layer. + +BOTTOM_LAYER="cec906613726ec32de92af0ec1cd6692c34df78782227f4415cd12c47a264dd4" + +mkdir -p "$TEMP_GIBBERISH/ptth" + +sudo docker build -t ptth:latest . +sudo docker image save ptth:latest | pv > "$TEMP_TAR" +tar -C "$TEMP_GIBBERISH/ptth" -xf "$TEMP_TAR" + +rm -rf "$TEMP_GIBBERISH/ptth/$BOTTOM_LAYER" + +pushd "$TEMP_GIBBERISH/ptth" + tar -czf "$UPLOADABLE_TAR" . +popd