feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run
Some checks are pending
Qualité / tests (push) Waiting to run
This commit is contained in:
33
scripts/compose.sh
Normal file
33
scripts/compose.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
docker_socket="/var/run/docker.sock"
|
||||
if [[ ! -S "$docker_socket" ]]; then
|
||||
echo "Socket Docker introuvable: $docker_socket" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Docker authorizes socket access by numeric GID. Detect it for every Compose
|
||||
# invocation so CodexPi keeps working if Docker recreates the socket with a
|
||||
# different host group after an upgrade or reboot. An exported value takes
|
||||
# precedence over the installation-time fallback stored in .env.
|
||||
export DOCKER_GID="$(stat -c '%g' "$docker_socket")"
|
||||
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
exec docker compose "$@"
|
||||
fi
|
||||
if command -v docker-compose >/dev/null 2>&1; then
|
||||
exec docker-compose "$@"
|
||||
fi
|
||||
|
||||
# DietPi may provide the Docker engine without the Compose plugin. Reuse the
|
||||
# pinned Docker CLI image instead of installing a global host package. Mounting
|
||||
# the repository at the same absolute path keeps all relative bind mounts
|
||||
# deterministic from the daemon's point of view.
|
||||
base="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
exec docker run --rm \
|
||||
-e DOCKER_GID="$DOCKER_GID" \
|
||||
-v "$docker_socket:$docker_socket" \
|
||||
-v "$base:$base" \
|
||||
-w "$base" \
|
||||
docker:cli compose "$@"
|
||||
Reference in New Issue
Block a user