akkoma-build/build.sh

29 lines
708 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}"
if [ ! -d akkoma ]; then
git clone https://akkoma.dev/AkkomaGang/akkoma.git akkoma
fi
pushd akkoma
git fetch --all
git checkout "${AKKOMA_COMMIT}"
if [ "$(git rev-parse HEAD)" != "${AKKOMA_COMMIT}" ]; then
exit 1
fi
docker build \
-t "${AKKOMA_BASE_IMAGE}" \
.
docker push "${AKKOMA_BASE_IMAGE}"
popd
docker build \
-t "${AKKOMA_FINAL_IMAGE}" \
--build-arg "AKKOMA_COMMIT=${AKKOMA_COMMIT}" \
.
docker push "${AKKOMA_FINAL_IMAGE}"