Newer
Older
dockersand / dockerfiles / build-img.sh
#!/bin/sh
# Build specified docker image and tag with today's date

# 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=${1}:latest
DATED=${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}