Skip to content

Commit

Permalink
Merge pull request #2 from SouthernMethodistUniversity/biostats_mcgee
Browse files Browse the repository at this point in the history
Image naming redo.
  • Loading branch information
rkalescky authored Feb 7, 2023
2 parents 923e167 + 2d8e113 commit d8ad56a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions biostats_mcgee/build_images.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env zsh

# Set container
name="biostats"

# Set version
version="latest"

Expand All @@ -14,18 +17,17 @@ m[2,3,p])
;;
esac

# Singularity image name
img="${name}_${version}_$(date "+%Y_%m_%d_%H_%M_%S").sif"

# Build container with Docker
docker build --platform ${platform} -t biostats:${version} .
docker build --no-cache --progress=plain\
--platform ${platform} -t ${name}:${version} . |& tee build.log

# Convert Docker image to Singularity image
docker run -v /var/run/docker.sock:/var/run/docker.sock\
-v $PWD:/output --privileged -t --rm\
singularityware/docker2singularity biostats:${version} | tee build.log

# Get Singularity image name
simg=$(basename $(awk '/Build complete/{print $NF}' build.log) | tr -d '\b\r')
img="${simg%.*}.sif"
mv $simg $img
-v $PWD:/output --privileged -t --rm singularityware/docker2singularity\
-n ${img} ${name}:${version} |& tee -a build.log

# Change Singularity image permissions
if [[ $(uname -s) == "Linux" ]]; then
Expand All @@ -34,5 +36,5 @@ fi

# Update module file with new Singularity image name
sed -i'' -e "s/^local img_name.*/local img_name = \'${img}\'/g"\
biostats.lua
${name}.lua

0 comments on commit d8ad56a

Please sign in to comment.