diff --git a/updater/docker-compose.yml b/updater/docker-compose.yml index fa74e92..7a0ff52 100644 --- a/updater/docker-compose.yml +++ b/updater/docker-compose.yml @@ -6,4 +6,4 @@ services: env_file: - .env volumes: - - ${DOCKER_CONFIG_DIR}:/config \ No newline at end of file + - ${DOCKER_CONFIG_DIR}:${DOCKER_CONFIG_DIR} \ No newline at end of file diff --git a/updater/webhook.php b/updater/webhook.php index cb7f490..10e8ce6 100644 --- a/updater/webhook.php +++ b/updater/webhook.php @@ -9,6 +9,12 @@ if (empty($secret_key)) { exit(); } +$docker_config_dir = getenv('DOCKER_CONFIG_DIR'); +if (empty($docker_config_dir)) { + error_log('FAILED - docker config dir missing from environment'); + exit(); +} + // check for POST request if ($_SERVER['REQUEST_METHOD'] != 'POST') { error_log('FAILED - not POST - ' . $_SERVER['REQUEST_METHOD']); @@ -60,9 +66,9 @@ if (json_last_error() !== JSON_ERROR_NONE) { // success, log something without error_log error_log('SUCCESS - ' . $decoded['ref']); -chdir('/config'); +chdir($docker_config_dir); exec('git pull'); -exec('docker compose up -d --quiet-pull > /proc/1/fd/1 2>/proc/1/fd/2 &'); +exec('docker compose up -d --quiet-pull > /dev/stdout 2>/dev/stderr &'); // send return code and text message http_response_code(200);