#!/bin/bash

if [ "xxx${VERSION}" = "xxx" ]; then
   VERSION='latest'
fi

export SSL_CERT_FILE=${PWD}/DigiCertCA.crt

docker login git.ia2.inaf.it:5050

# Use below to optimize for a specific architecture
# docker build -t git.ia2.inaf.it:5050/lofarit/containers/vlbi-inaf-sw:${VERSION} --build-arg CFLAGS_GLOBAL="-march=skylake-avx512 -mtune=skylake-avx512" \
#         --build-arg CXXFLAGS_GLOBAL="-march=skylake-avx512 -mtune=skylake-avx512" -f Dockerfile .
#
# Default values
#
# CMAKE_C_COMPILER=/usr/bin/gcc
# CMAKE_CXX_COMPILER=/usr/bin/g++
# CC_GLOBAL=/usr/bin/gcc
# CXX_GLOBAL=/usr/bin/g++
# MPICC=/usr/lib64/openmpi/bin/mpicc
# MPICXX=/usr/lib64/openmpi/bin/mpic++
# CFLAGS_GLOBAL="-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
# CXXFLAGS_GLOBAL="-std=c++11 -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma -mno-avx512vbmi"
# CASA_CXXFLAGS
# CASA_CFLAGS


docker build -t git.ia2.inaf.it:5050/lofarit/containers/vlbi-inaf-sw:${VERSION} -f Dockerfile .
