Skip to content

Commit

Permalink
Updating docker build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
cianwilson committed May 6, 2024
1 parent 6e52764 commit 4072e7b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
22 changes: 13 additions & 9 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
Expand Down Expand Up @@ -78,21 +79,24 @@ 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
PTAG="amd64"
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
Expand All @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions docker/focal/actions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#

# build using the TerraFERMA development environment
FROM ghcr.io/terraferma/dev-env:fenics-2019.1.0-focal
MAINTAINER terraferma <[email protected].edu>
FROM ghcr.io/terraferma/dev-env:focal
MAINTAINER Cian Wilson <cwilson@carnegiescience.edu>

USER tfuser
WORKDIR $TF_HOME/TerraFERMA
Expand Down
2 changes: 1 addition & 1 deletion docker/focal/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected].edu>
MAINTAINER Cian Wilson <cwilson@carnegiescience.edu>

# Get Ubuntu updates
USER root
Expand Down
4 changes: 2 additions & 2 deletions docker/focal/dev-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected].edu>
MAINTAINER Cian Wilson <cwilson@carnegiescience.edu>

ARG DEBUG=0

Expand Down
6 changes: 3 additions & 3 deletions docker/focal/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected].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

Expand Down

0 comments on commit 4072e7b

Please sign in to comment.