akkoma-build/build.sh
2023-07-23 15:08:26 -05:00

37 lines
844 B
Bash
Executable file

#!/bin/bash
set -Eeuxo pipefail
AKKOMA_COMMIT="024578a659d453ae61e7535cb73758f760af375a"
AKKOMA_BASE_IMAGE="registry.nrd.li/nrdli/akkoma:${AKKOMA_COMMIT}"
# clone akkoma source code
if [ -d akkoma ]; then
rm -rf akkoma
fi
git clone https://git.keganmyers.com/nrd.li/akkoma.git akkoma
pushd akkoma
git fetch --all
git checkout "${AKKOMA_COMMIT}"
if [ "$(git rev-parse HEAD)" != "${AKKOMA_COMMIT}" ]; then
exit 1
fi
# build and store base image
docker build \
-t "${AKKOMA_BASE_IMAGE}" \
.
docker push "${AKKOMA_BASE_IMAGE}"
popd
chown -R 1000:1000 ./akkoma
# run install steps for akkoma
docker run --rm \
-itv "$(pwd)/akkoma:/opt/akkoma" \
-v "$(pwd)/prod.secret.exs:/config/prod.secret.exs" \
-v "$(pwd)/.build.sh:/build.sh" \
--entrypoint "" \
"${AKKOMA_BASE_IMAGE}" \
/build.sh
# docker push "${AKKOMA_FINAL_IMAGE}"