mirror of
https://github.com/pooneyy/1Panel-Appstore.git
synced 2026-03-18 01:01:02 +08:00
- Add new `DOCKER_MODE` form field to choose between `dood` and `dind` modes, removing old `PRIVILEGED` mode field and `-dind` variant application - Update `docker-compose.yml` to conditionally include `dind` service based on mode, and refactor `init.sh` to dynamically set `DOCKER_HOST` environment variable - Refactor `register.sh` to handle both modes, configure runner accordingly, update default values for registration fields, and define the default job container base image as node:lts - Update README with detailed security risk warnings for both modes, remove version selection instructions, and add usage examples for custom container images and installing docker client in workflows
35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
echo "Waiting for Docker daemon to be ready..."
|
|
apk update && apk add --no-cache curl
|
|
until curl -s http://dind:2375/_ping | grep -q "OK"; do
|
|
sleep 1
|
|
done
|
|
echo "Docker daemon is ready."
|
|
cd /data
|
|
if [ -z "$RUNNER_LABELS" ]; then
|
|
RUNNER_LABELS="docker"
|
|
fi
|
|
if [ ! -s .runner ]; then
|
|
echo ">>> Registering runner..."
|
|
forgejo-runner register --no-interactive \
|
|
--instance "$FORGEJO_INSTANCE_URL" \
|
|
--token "$RUNNER_REGISTRATION_TOKEN" \
|
|
--name "$RUNNER_NAME" \
|
|
--labels "${RUNNER_LABELS}:docker://node:lts"
|
|
fi
|
|
echo ">>> Create config..."
|
|
forgejo-runner generate-config > config.yml
|
|
sed -i 's#^ force_pull:.*$# force_pull: true#' config.yml
|
|
if [ "$DOCKER_MODE" = "dood" ]; then
|
|
sed -i 's#^ network:.*$# network: 1panel-network#' config.yml
|
|
sed -i 's#^ docker_host:.*$# docker_host: unix:///var/run/docker.sock#' config.yml
|
|
elif [ "$DOCKER_MODE" = "dind" ]; then
|
|
sed -i '/envs:/a\ DOCKER_HOST: tcp://dind:2375' config.yml
|
|
sed -i 's#^ docker_host:.*$# docker_host: tcp://dind:2375#' config.yml
|
|
sed -i 's#^ privileged:.*$# privileged: true#' config.yml
|
|
sed -i 's#^ options:.*$# options: --add-host=dind:host-gateway#' config.yml
|
|
fi
|
|
echo ">>> Starting daemon..."
|
|
exec forgejo-runner --config config.yml daemon
|