#!/bin/bash

# File needs to be called /hooks/build relative to the Dockerfile.
# $IMAGE_NAME var is injected into the build so the tag is correct.

for SLURM_VERSION in 16.05 17.02
do
    docker build \
        --file "Dockerfile" \
        --tag "$DOCKER_REPO:slurm$SLURM_VERSION" \
        --build-arg "SLURM_VER=$SLURM_VERSION" \
        --build-arg "BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \
        --build-arg "VCS_REF=`git rev-parse --short HEAD`" \
        .

    docker build \
        --file "Dockerfile.apache" \
        --tag "$DOCKER_REPO:slurm$SLURM_VERSION-apache" \
        --build-arg "SLURM_VER=$SLURM_VERSION" \
        --build-arg "BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`" \
        --build-arg "VCS_REF=`git rev-parse --short HEAD`" \
        .
done
