This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the functionality to add browser versions to the Docker Hub tag…
…s. Also, updated the 'latest' tag.
- Loading branch information
1 parent
5709ba6
commit 7754dc7
Showing
5 changed files
with
97 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
"io/ioutil" | ||
"log" | ||
"net/http" | ||
"fmt" | ||
"encoding/json" | ||
"os" | ||
) | ||
|
||
type Latest struct { | ||
Images []struct { | ||
Architecture string `json:"architecture"` | ||
Digest string `json:"digest"` | ||
} | ||
} | ||
|
||
|
||
func main() { | ||
argLen := len(os.Args) | ||
if argLen < 2 { | ||
showUsage() | ||
os.Exit(1) | ||
} | ||
|
||
url := os.Args[1] // https://hub.docker.com/v2/repositories/selenium/standalone-chrome/tags/latest/ | ||
resp, err := http.Get(url) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
|
||
body, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
|
||
var jsonResp Latest | ||
sb := string(body) | ||
json.Unmarshal([]byte(sb), &jsonResp) | ||
|
||
for _, image := range jsonResp.Images { | ||
fmt.Printf(image.Architecture + " " + image.Digest + "\n") | ||
} | ||
} | ||
|
||
func showUsage() { | ||
fmt.Println(`Usage: | ||
get-image-sha256-digest TAG_URL | ||
TAG_URL -> URL for a container image manifest (Required) | ||
Example Usage: | ||
$ get-image-sha256-digest https://hub.docker.com/v2/repositories/selenium/standalone-chrome/tags/latest/ | ||
`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
VERSION=$1 | ||
BUILD_DATE=$2 | ||
NAMESPACE="${3:-seleniarm}" | ||
IMAGE=$4 | ||
NEW_TAG=$5 | ||
|
||
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ]; then | ||
echo "Be sure to pass in all of the values" | ||
exit 1 | ||
fi | ||
|
||
|
||
AMD64_DIGEST=`go run get-image-sha256-digest.go https://hub.docker.com/v2/repositories/$NAMESPACE/$IMAGE/tags/$VERSION-$BUILD_DATE/ | grep -w "amd64" | awk '{print $2}'` | ||
ARM_DIGEST=`go run get-image-sha256-digest.go https://hub.docker.com/v2/repositories/$NAMESPACE/$IMAGE/tags/$VERSION-$BUILD_DATE/ | grep -w "arm" | awk '{print $2}'` | ||
ARM64_DIGEST=`go run get-image-sha256-digest.go https://hub.docker.com/v2/repositories/$NAMESPACE/$IMAGE/tags/$VERSION-$BUILD_DATE/ | grep -w "arm64" | awk '{print $2}'` | ||
|
||
docker manifest create $NAMESPACE/$IMAGE:$NEW_TAG \ | ||
--amend $NAMESPACE/$IMAGE@$AMD64_DIGEST \ | ||
--amend $NAMESPACE/$IMAGE@$ARM_DIGEST \ | ||
--amend $NAMESPACE/$IMAGE@$ARM64_DIGEST | ||
|
||
docker manifest push $NAMESPACE/$IMAGE:$NEW_TAG | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters