Skip to content

Commit

Permalink
use full path to docker and singularity
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSimpson committed Feb 5, 2018
1 parent 1b929f2 commit de0f6ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Builder/scripts/docker-builder-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,32 @@ grep 'FROM code.ornl.gov:4567' ./container.def
GREP_RC=$?
if [[ ${GREP_RC} -eq 0 ]] ; then
echo "Using OLCF Gitlab registry login credentials"
docker login code.ornl.gov:4567 -u ${GITLAB_READONLY_USERNAME} -p ${GITLAB_READONLY_TOKEN} 2>&1 >&${OUT_FD}
/usr/local/bindocker login code.ornl.gov:4567 -u ${GITLAB_READONLY_USERNAME} -p ${GITLAB_READONLY_TOKEN} 2>&1 >&${OUT_FD}
fi

# provide read only access to the private olcf dockerhub repository
grep 'FROM olcf/' ./container.def
GREP_RC=$?
if [[ ${GREP_RC} -eq 0 ]] ; then
echo "Using OLCF Dockerhub registry login credentials"
docker login -u ${DOCKERHUB_READONLY_USERNAME} -p ${DOCKERHUB_READONLY_TOKEN} 2>&1 >&${OUT_FD}
/usr/local/bin/docker login -u ${DOCKERHUB_READONLY_USERNAME} -p ${DOCKERHUB_READONLY_TOKEN} 2>&1 >&${OUT_FD}
fi

# Spin up local registry
docker ${DEBUG_FLAG} run -d -p 5000:5000 --restart=always --name registry registry:2 2>&1 >&${OUT_FD}
/usr/local/bin/docker ${DEBUG_FLAG} run -d -p 5000:5000 --restart=always --name registry registry:2 2>&1 >&${OUT_FD}

# Build the Dockerfile docker image in the current directory
mv ./container.def Dockerfile
/usr/bin/unbuffer docker ${DEBUG_FLAG} build -t localhost:5000/docker_image:latest . || { echo 'Build Failed' ; exit 1; }
/usr/bin/unbuffer /usr/local/bin/docker ${DEBUG_FLAG} build -t localhost:5000/docker_image:latest . || { echo 'Build Failed' ; exit 1; }

# Push to the local registry
docker ${DEBUG_FLAG} push localhost:5000/docker_image:latest
/usr/local/bin/docker ${DEBUG_FLAG} push localhost:5000/docker_image:latest

# Build the singularity container from the docker image
export SINGULARITY_CACHEDIR=/home/builder/.singularity
export SINGULARITY_NOHTTPS=true
export SINGULARITY_PULLFOLDER=/home/builder
/usr/bin/unbuffer singularity ${DEBUG_FLAG} pull --name container.simg docker://localhost:5000/docker_image:latest
/usr/bin/unbuffer /usr/local/bin/singularity ${DEBUG_FLAG} pull --name container.simg docker://localhost:5000/docker_image:latest

# Workaround for PULLFOLDER not being respected: https://github.com/singularityware/singularity/pull/855
if [ -e ${SINGULARITY_CACHEDIR}/container.simg ] ; then
Expand Down

0 comments on commit de0f6ac

Please sign in to comment.