Skip to content

Instantly share code, notes, and snippets.

@dotysan
Created March 20, 2026 15:04
Show Gist options
  • Select an option

  • Save dotysan/9c17e06a310ba3957082ed8451f57ca8 to your computer and use it in GitHub Desktop.

Select an option

Save dotysan/9c17e06a310ba3957082ed8451f57ca8 to your computer and use it in GitHub Desktop.
Install perkeep (client utils) on a Go-less system using Go in Docker
#! /usr/bin/env bash
#
# Install perkeep (client utils) on a Go-less system using Go in Docker.
#
set -e
set -u
set -x
main() {
# latest stable release
PK_TAG=v0.12
GO_VER=1-trixie
src
img
bld
ins
cln
}
src() {
if [[ ! -d perkeep ]]
then git clone git@github.com:perkeep/perkeep.git
fi
cd perkeep
git switch --detach "$PK_TAG"
}
img() {
docker pull "golang:$GO_VER"
docker build --progress=plain --tag=build-perkeep - <<-EOF
FROM "golang:$GO_VER"
# # give make build proper perms in .:/perkeep
RUN useradd --uid "$UID" --gid "${GROUPS[0]}" \
--create-home --shell /bin/bash "$USER"
# build static binary
ENV CGO_ENABLED=0
# put it in the dev tree
ENV GOBIN=/perkeep/bin
WORKDIR /perkeep
EOF
docker image ls |grep perkeep
}
bld() {
test ! -s bin/perkeepd ||return 0
docker run --rm \
--volume="$PWD:/perkeep" \
--user="$UID:"${GROUPS[0]}"" \
build-perkeep \
go run make.go -v
}
ins() {
mkdir --parents "$HOME/.local/bin"
cp --force --preserve bin/pk* $HOME/.local/bin
}
cln() {
cd ..
rm --force --recursive perkeep
docker image rm build-perkeep
}
main "$@"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment