chore: repo skeleton + grounded NOTES
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -W)
|
||||
ROOT=$(cd "$HERE/.." && pwd -W)
|
||||
IMAGE=${IMAGE:-php:8.4.26-apache}
|
||||
NAME=${NAME:-p2s-lab}
|
||||
PORT=${PORT:-18110}
|
||||
NET=${NET:-}
|
||||
|
||||
docker rm -f "$NAME" >/dev/null 2>&1 || true
|
||||
mkdir -p "$ROOT/out"
|
||||
|
||||
NETARG=""
|
||||
if [ -n "$NET" ]; then
|
||||
docker network create "$NET" >/dev/null 2>&1 || true
|
||||
NETARG="--network $NET"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker run -d --name "$NAME" $NETARG \
|
||||
-p "127.0.0.1:$PORT:80" \
|
||||
-v "$HERE/index.php:/var/www/html/index.php:ro" \
|
||||
-v "$HERE/apache-single-worker.conf:/etc/apache2/conf-enabled/zz-p2s.conf:ro" \
|
||||
-v "$ROOT/out:/out" \
|
||||
"$IMAGE" /bin/sh -c 'cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
|
||||
chown -R www-data:www-data /out 2>/dev/null || true
|
||||
exec apache2-foreground' >/dev/null
|
||||
|
||||
for _ in $(seq 1 60); do
|
||||
if curl -s -m 2 "http://127.0.0.1:$PORT/index.php" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
echo "target: $(curl -s -m 3 "http://127.0.0.1:$PORT/index.php")"
|
||||
Reference in New Issue
Block a user