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.
Adding script used to build the multi-arch images, but locally using …
…only one architecture.
- Loading branch information
1 parent
2d70460
commit ba4ec07
Showing
1 changed file
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
#SELENIUM_VERSION=$(grep selenium-server Base/Dockerfile | sed 's/.*-\([^-]*\)\.jar \\/\1/' | head -n 1) | ||
NAME="${NAME:-seleniarm}" | ||
VERSION="${VERSION:-$SELENIUM_VERSION}" | ||
BUILD_DATE="${BUILD_DATE:-$(date '+%Y%m%d')}" | ||
PLATFORMS="${PLATFORMS:-linux/arm64,linux/arm/v7,linux/amd64}" | ||
#BUILD_ARGS=--push | ||
|
||
FROM_IMAGE_ARGS="--build-arg NAMESPACE=$NAME --build-arg VERSION=$VERSION-$BUILD_DATE" | ||
TAG_VERSION=$VERSION-$BUILD_DATE | ||
|
||
START=$(date +'%s') | ||
echo $START | ||
|
||
echo "Build and push images for target $1" | ||
|
||
#docker run --rm --privileged aptman/qus -- -r | ||
#docker run --rm --privileged aptman/qus -s -- -p | ||
|
||
if [ "$1" = "base_multi" ]; then | ||
cd ./Base && docker build ${BUILD_ARGS} --build-arg RELEASE=${RELEASE} --build-arg VERSION=${VERSION} -t ${NAME}/base:${TAG_VERSION} . | ||
|
||
elif [ "$1" = "grid_multi" ]; then | ||
cd ./Hub && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/hub:${TAG_VERSION} . | ||
cd ../Distributor && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/distributor:${TAG_VERSION} . | ||
cd ../Router && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/router:${TAG_VERSION} . | ||
cd ../Sessions && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/sessions:${TAG_VERSION} . | ||
cd ../SessionQueue && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/session-queue:${TAG_VERSION} . | ||
cd ../NodeDocker && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/node-docker:${TAG_VERSION} . | ||
cd ../EventBus && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/event-bus:${TAG_VERSION} . | ||
# Prevent "failed to solve" errors by adding delay between NodeDocker and StandaloneDocker | ||
# by building EventBus in between them. | ||
cd ../StandaloneDocker && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/standalone-docker:${TAG_VERSION} . | ||
|
||
elif [ "$1" = "node_base_multi" ]; then | ||
cd ./NodeBase && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/node-base:${TAG_VERSION} . | ||
|
||
elif [ "$1" = "firefox_multi" ]; then | ||
FROM_IMAGE_ARGS="$FROM_IMAGE_ARGS --build-arg BASE=node-firefox" | ||
cd ./NodeFirefox && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -f Dockerfile.multi-arch -t ${NAME}/node-firefox:${TAG_VERSION} . | ||
sleep 5 # Prevent "failed to solve" errors when trying to pull NodeFirefox dependency | ||
cd ../Standalone && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/standalone-firefox:${TAG_VERSION} . | ||
|
||
elif [ "$1" = "chromium_multi" ]; then | ||
FROM_IMAGE_ARGS="$FROM_IMAGE_ARGS --build-arg BASE=node-chromium" | ||
cd ./NodeChromium && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/node-chromium:${TAG_VERSION} . | ||
sleep 5 # Prevent "failed to solve" errors when trying to pull NodeChromium dependency | ||
cd ../Standalone && docker build ${BUILD_ARGS} ${FROM_IMAGE_ARGS} -t ${NAME}/standalone-chromium:${TAG_VERSION} . | ||
|
||
elif [ "$1" = "tag_and_push_multi_arch_browser_images" ]; then | ||
#make tag_and_push_multi_arch_browser_images | ||
echo "Tag images and generate release notes" | ||
|
||
else | ||
echo "$1 not found. Options are 'base_multi', 'grid_multi', 'node_base_multi', 'firefox_multi', and 'chromium_multi'" | ||
SE_BUILD_CODE=1 | ||
fi | ||
|
||
SE_BUILD_CODE=${SE_BUILD_CODE:-$(echo $?)} | ||
|
||
STOP=$(date +'%s') | ||
echo $(( $STOP - $START )) seconds | ||
|
||
exit $SE_BUILD_CODE |