Files
crank/apps/admin-api/docker-entrypoint.sh
bsodfather f685616ae8
CI / Rust Checks (pull_request) Successful in 23m1s
CI / UI Checks (pull_request) Successful in 6s
CI / Community Image Smoke (pull_request) Successful in 7m28s
CI / Frontend E2E (pull_request) Successful in 9m33s
CI / Deploy (pull_request) Skipped
fix(security): minimize runtime images and enforce complete vulnerability scans
2026-10-10 01:41:38 +03:00

37 lines
1.1 KiB
Bash

#!/bin/sh
set -eu
# Docker creates a fresh named volume as root:root 0755. The artifact store
# deliberately rejects that mode: before starting the API, provision exactly
# the private root its pinned-directory checks require.
provision_storage_root() {
storage_root="${CRANK_STORAGE_ROOT:-/var/lib/crank/storage}"
case "$storage_root" in
/*) ;;
*)
echo "CRANK_STORAGE_ROOT must be an absolute path" >&2
exit 64
;;
esac
if [ -L "$storage_root" ] || { [ -e "$storage_root" ] && [ ! -d "$storage_root" ]; }; then
echo "CRANK_STORAGE_ROOT must be a directory, not a symlink or file" >&2
exit 64
fi
umask 077
mkdir -p -- "$storage_root"
chmod 0700 -- "$storage_root"
}
# The dedicated init service calls this entrypoint as `crank-storage-init`; it
# provisions the artifact root and exits without running a server binary.
if [ "${1:-}" = "crank-storage-init" ]; then
provision_storage_root
exit 0
fi
if [ "${1:-}" = "admin-api" ]; then
provision_storage_root
fi
exec "$@"