akkoma-build/build.sh

34 lines
808 B
Bash
Executable file

#!/bin/bash
set -Eeuxo pipefail
AKKOMA_COMMIT="9d7c877de049303a4d4d8f5ecaac7da94ca59ebb"
LOCAL_COMMIT=$(git rev-parse HEAD)
AKKOMA_BASE_IMAGE="registry.nrd.li/nrdli/akkoma-base:${AKKOMA_COMMIT}"
AKKOMA_FINAL_IMAGE="registry.nrd.li/nrdli/akkoma:${LOCAL_COMMIT}"
# clone akkoma source code
if [ -d akkoma ]; then
rm -rf akkoma
fi
git clone https://akkoma.dev/AkkomaGang/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
# run install steps for akkoma
docker build \
-t "${AKKOMA_FINAL_IMAGE}" \
--build-arg "AKKOMA_COMMIT=${AKKOMA_COMMIT}" \
.
docker push "${AKKOMA_FINAL_IMAGE}"