akkoma-build/build.sh

38 lines
894 B
Bash
Raw Normal View History

2023-07-23 03:49:40 +00:00
#!/bin/bash
set -Eeuxo pipefail
2023-07-23 20:08:26 +00:00
AKKOMA_COMMIT="024578a659d453ae61e7535cb73758f760af375a"
AKKOMA_BASE_IMAGE="registry.nrd.li/nrdli/akkoma:${AKKOMA_COMMIT}"
2023-07-23 03:49:40 +00:00
2023-07-23 18:20:16 +00:00
# clone akkoma source code
if [ -d akkoma ]; then
rm -rf akkoma
fi
git clone https://git.keganmyers.com/nrd.li/akkoma.git akkoma
2023-07-23 08:17:35 +00:00
pushd akkoma
git fetch --all
git checkout "${AKKOMA_COMMIT}"
if [ "$(git rev-parse HEAD)" != "${AKKOMA_COMMIT}" ]; then
exit 1
fi
2023-07-23 18:20:16 +00:00
# build and store base image
2023-07-23 03:49:40 +00:00
docker build \
-t "${AKKOMA_BASE_IMAGE}" \
.
docker push "${AKKOMA_BASE_IMAGE}"
popd
2023-07-23 03:49:40 +00:00
chown -R 1000:1000 ./akkoma
2023-07-23 18:20:16 +00:00
# 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" \
2023-07-23 20:33:08 +00:00
-e "PROD_SECRET_FILE=/config/prod.secret.exs" \
--entrypoint "" \
"${AKKOMA_BASE_IMAGE}" \
/build.sh
# docker push "${AKKOMA_FINAL_IMAGE}"