#!/bin/sh # Build specified docker image and tag with today's date REGISTRY="dockersand:5000" # Setup correct permissions for ssh files chmod 600 common/keys/*key chmod 700 common/.ssh chmod 600 common/.ssh/* chmod 644 common/.ssh/*.pub # Tags LATEST=${REGISTRY}/${1}:latest DATED=${REGISTRY}/${1}:`date +%Y%m%d` # Get rid of older images docker rmi ${DATED} ${LATEST} # Build new image sudo docker build -f ${1}/${1}.dockerfile -t ${LATEST} . # Tag it with date docker tag ${LATEST} ${DATED}