From 4072e7b0467e7c0b71aa364979d26b0875e7c1d6 Mon Sep 17 00:00:00 2001 From: Cian Wilson <cwilson@carnegiescience.edu> Date: Sun, 5 May 2024 19:26:15 -0500 Subject: [PATCH] Updating docker build scripts. --- docker/build.sh | 22 +++++++++++++--------- docker/focal/actions/Dockerfile | 4 ++-- docker/focal/base/Dockerfile | 2 +- docker/focal/dev-env/Dockerfile | 4 ++-- docker/focal/dev/Dockerfile | 6 +++--- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index 387d39ba..7bed1551 100644 --- a/docker/build.sh +++ b/docker/build.sh @@ -10,10 +10,10 @@ usage() { echo "bash $0 [-h] [-t tag<string>] [-b branch<string>] [-r repo<string>] [-p platform<string>,platform<string>] [-d] dir<string>" 1>&2 echo " dir: required name of the subdirectory containing the Dockerfile" 1>&2 echo " -h: print this help message and exit" 1>&2 - echo " -t: specify a tag name (defaults to fenics-2019.1.0-focal)" 1>&2 - echo " -b: specify a branch name (defaults to master-2019.1.0)" 1>&2 + echo " -t: specify a tag name (defaults to focal-<branch if not main>-<debug>-<platform>)" 1>&2 + echo " -b: specify a branch name (defaults to main)" 1>&2 echo " -r: specify a repo URL (defaults to https://github.com/TerraFERMA/TerraFERMA.git)" 1>&2 - echo " -d: enable debugging (if tag name is default, suffixes name with -debug)" 1>&2 + echo " -d: enable debugging (if tag name is default, suffixes tag with -debug)" 1>&2 echo " -p: comma separated list of platforms (defaults to current platform)" 1>&2 } @@ -33,10 +33,11 @@ repo_path=$(dirname $script_path) # parse the arguments TAG='' -BRANCH='master-2019.1.0' +BRANCH='main' REPO='https://github.com/TerraFERMA/TerraFERMA.git' DEBUG=0 PLATFORMS='' +BUILDER='' while getopts ":t:b:r:p:dh" opt; do case $opt in @@ -78,8 +79,9 @@ if [ $# == 0 ]; then fi DIR=$(realpath $1) SDIR=$(basename $DIR) +ADIR=$(basename $(dirname $DIR) ) -PTAG='' +PTAG='userplatform' if [ -z "$PLATFORMS" ]; then PROC=`uname -m` if [ "$PROC" == "x86_64" ]; then @@ -87,12 +89,14 @@ if [ -z "$PLATFORMS" ]; then elif [ "$PROC" == "arm64" ]; then PTAG="arm64" fi +else + BUILDER='buildx' fi -# if no tag is specified default to fenics-2019.1.0-focal +# if no tag is specified default to arch dir if [ -z "$TAG" ]; then - TAG="fenics-2019.1.0-focal" - if [ "$BRANCH" != 'master-2019.1.0' ]; then + TAG="$ADIR" + if [ "$BRANCH" != 'main' ]; then TAG="${TAG}-$BRANCH" fi if [ $DEBUG -eq 1 ]; then @@ -115,7 +119,7 @@ if [ $DEBUG -eq 1 ]; then fi cd $repo_path -docker buildx build --file $DIR/Dockerfile \ +docker $BUILDER build --file $DIR/Dockerfile \ --build-arg TAG=$TAG \ --build-arg BRANCH=$BRANCH \ --build-arg DEBUG=$DEBUG \ diff --git a/docker/focal/actions/Dockerfile b/docker/focal/actions/Dockerfile index 221ecc9e..65bf3598 100644 --- a/docker/focal/actions/Dockerfile +++ b/docker/focal/actions/Dockerfile @@ -26,8 +26,8 @@ # # build using the TerraFERMA development environment -FROM ghcr.io/terraferma/dev-env:fenics-2019.1.0-focal -MAINTAINER terraferma <terraferma@lists.columbia.edu> +FROM ghcr.io/terraferma/dev-env:focal +MAINTAINER Cian Wilson <cwilson@carnegiescience.edu> USER tfuser WORKDIR $TF_HOME/TerraFERMA diff --git a/docker/focal/base/Dockerfile b/docker/focal/base/Dockerfile index 896ec115..3f0b7fea 100644 --- a/docker/focal/base/Dockerfile +++ b/docker/focal/base/Dockerfile @@ -34,7 +34,7 @@ # build off Ubuntu 20.04LTS (Focal) with a few fixes for docker FROM phusion/baseimage:focal-1.2.0 -MAINTAINER terraferma <terraferma@lists.columbia.edu> +MAINTAINER Cian Wilson <cwilson@carnegiescience.edu> # Get Ubuntu updates USER root diff --git a/docker/focal/dev-env/Dockerfile b/docker/focal/dev-env/Dockerfile index 1af8986b..2ce30ee7 100644 --- a/docker/focal/dev-env/Dockerfile +++ b/docker/focal/dev-env/Dockerfile @@ -30,9 +30,9 @@ # # build from the base image -ARG TAG=fenics-2019.1.0-focal +ARG TAG=focal FROM ghcr.io/terraferma/base:${TAG} -MAINTAINER terraferma <terraferma@lists.columbia.edu> +MAINTAINER Cian Wilson <cwilson@carnegiescience.edu> ARG DEBUG=0 diff --git a/docker/focal/dev/Dockerfile b/docker/focal/dev/Dockerfile index 6a8cad84..2b8d1c3a 100644 --- a/docker/focal/dev/Dockerfile +++ b/docker/focal/dev/Dockerfile @@ -26,11 +26,11 @@ # # build using the TerraFERMA development environment -ARG TAG=fenics-2019.1.0-focal +ARG TAG=focal FROM ghcr.io/terraferma/dev-env:${TAG} -MAINTAINER terraferma <terraferma@lists.columbia.edu> +MAINTAINER Cian Wilson <cwilson@carnegiescience.edu> -ARG BRANCH=master-2019.1.0 +ARG BRANCH=main ARG REPO=https://github.com/TerraFERMA/TerraFERMA.git ARG DEBUG=0