Skip to content

Commit

Permalink
fix(test): Changed local registry url from 'localhost' to '127.0.0.1'…
Browse files Browse the repository at this point in the history
… and scoped docker config to test
  • Loading branch information
vehagn authored and eoftedal committed Jan 17, 2024
1 parent ea21127 commit f0e2be1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/localtest/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

set -e

export DOCKER_CONFIG=tmp
TESTUSER=testuser
TESTPASSWORD=testpassword
BASICAUTH=$(echo -n "$TESTUSER:$TESTPASSWORD" | base64)
LOCAL_REGISTRY=127.0.0.1

rm -rf tmp
mkdir -p tmp/certs
Expand Down Expand Up @@ -46,28 +48,28 @@ printf "* Pulling node:alpine as base image...\n"
docker pull node:alpine &> /dev/null

printf "* Pushing base image to local containerify test registry...\n"
docker tag node:alpine localhost:5443/node > /dev/null
echo -n $TESTPASSWORD | docker login -u $TESTUSER --password-stdin localhost:5443
docker push localhost:5443/node > /dev/null
docker tag node:alpine ${LOCAL_REGISTRY}:5443/node > /dev/null
echo -n $TESTPASSWORD | docker login -u $TESTUSER --password-stdin ${LOCAL_REGISTRY}:5443
docker push ${LOCAL_REGISTRY}:5443/node > /dev/null

printf "* Running containerify to pull from and push result to the local containerify test registry...\n"
cd ../integration/app
npm install
cd ../../localtest
../../lib/cli.js --fromImage node --doCrossMount --registry https://localhost:5443/v2/ --toImage containerify-integration-test:localtest --folder ../integration/app --setTimeStamp "2023-03-07T12:53:10.471Z" --allowInsecureRegistries --token "Basic $BASICAUTH"
../../lib/cli.js --fromImage node --doCrossMount --registry https://${LOCAL_REGISTRY}:5443/v2/ --toImage containerify-integration-test:localtest --folder ../integration/app --setTimeStamp "2023-03-07T12:53:10.471Z" --allowInsecureRegistries --token "Basic $BASICAUTH"


printf "\n* Pulling image from registry to local docker daemon...\n"
docker pull localhost:5443/containerify-integration-test:localtest &> /dev/null
docker pull ${LOCAL_REGISTRY}:5443/containerify-integration-test:localtest &> /dev/null

printf "* Running image on local docker daemon...\n"
docker run --rm -it localhost:5443/containerify-integration-test:localtest
docker run --rm -it ${LOCAL_REGISTRY}:5443/containerify-integration-test:localtest

printf "\n* Deleting image from registry to local docker daemon...\n"
docker rmi localhost:5443/containerify-integration-test:localtest > /dev/null
docker rmi ${LOCAL_REGISTRY}:5443/containerify-integration-test:localtest > /dev/null

printf "* Stopping local containerify test registry...\n"
docker stop registry-containerify-test > /dev/null
rm -rf tmp

printf "\nSUCCESS!\n"
printf "\nSUCCESS!\n"

0 comments on commit f0e2be1

Please sign in to comment.