mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-11-10 14:10:35 +08:00
Revert "get multiarch repodigest"
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
f5c32a1a67
commit
5a959e9b07
1 changed files with 20 additions and 22 deletions
|
|
@ -26,31 +26,29 @@ class DockerHubManager
|
||||||
// If one of the links below should ever become outdated, we can still upgrade the mastercontainer via the webinterface manually by opening '/api/docker/getwatchtower'
|
// If one of the links below should ever become outdated, we can still upgrade the mastercontainer via the webinterface manually by opening '/api/docker/getwatchtower'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$request = $this->guzzleClient->request(
|
$authTokenRequest = $this->guzzleClient->request(
|
||||||
'GET',
|
'GET',
|
||||||
'https://hub.docker.com/v2/repositories/' . $name . '/tags?page_size=128'
|
'https://auth.docker.io/token?service=registry.docker.io&scope=repository:' . $name . ':pull'
|
||||||
);
|
);
|
||||||
$body = $request->getBody()->getContents();
|
$body = $authTokenRequest->getBody()->getContents();
|
||||||
$decodedBody = json_decode($body, true);
|
$decodedBody = json_decode($body, true);
|
||||||
|
if(isset($decodedBody['token'])) {
|
||||||
if (isset($decodedBody['results'])) {
|
$authToken = $decodedBody['token'];
|
||||||
$arch = php_uname('m') === 'x86_64' ? 'amd64' : 'arm64';
|
$manifestRequest = $this->guzzleClient->request(
|
||||||
foreach($decodedBody['results'] as $values) {
|
'GET',
|
||||||
if (isset($values['name'])
|
'https://registry-1.docker.io/v2/'.$name.'/manifests/' . $tag,
|
||||||
&& $values['name'] === $tag
|
[
|
||||||
&& isset($values['images'])
|
'headers' => [
|
||||||
&& is_array($values['images'])) {
|
'Accept' => 'application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.index.v1+json',
|
||||||
foreach ($values['images'] as $images) {
|
'Authorization' => 'Bearer ' . $authToken,
|
||||||
if (isset($images['architecture'])
|
],
|
||||||
&& $images['architecture'] === $arch
|
]
|
||||||
&& isset($images['digest'])
|
);
|
||||||
&& is_string($images['digest'])) {
|
$responseHeaders = $manifestRequest->getHeader('docker-content-digest');
|
||||||
$latestVersion = $images['digest'];
|
if(count($responseHeaders) === 1) {
|
||||||
apcu_add($cacheKey, $latestVersion, 600);
|
$latestVersion = $responseHeaders[0];
|
||||||
return $latestVersion;
|
apcu_add($cacheKey, $latestVersion, 600);
|
||||||
}
|
return $latestVersion;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue