-
Notifications
You must be signed in to change notification settings - Fork 6
/
buildDocker.sh
executable file
·39 lines (29 loc) · 1.2 KB
/
buildDocker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /bin/bash
# Script to build convoar Docker image.
# Make user file 'VERSION' contains the latest version.
# Make sure you are logged onto DockerHub before running this script.
# Hacked version based on https://medium.com/travis-on-docker/how-to-version-your-docker-images-1d5c577ebf54
DOCKERHUB_USER=herbal3d
IMAGE=convoar
# export TARGET=Release
export TARGET=Debug
if [[ ! -e "./VERSION" ]] ; then
echo "No file named 'VERSION'. You might be in the wrong directory."
echo "Run the build script in the base project directory."
exit
fi
VERSION=$(cat VERSION)
# Build the docker image of the latest git commited sources.
DO_DOCKER_BUILD=yes
# Push the built docker image to DockerHub.
DO_DOCKERHUB_PUSH=yes
if [[ "$DO_DOCKER_BUILD" == "yes" ]] ; then
cd docker
# docker build --build-arg TARGET=${TARGET} --build-arg VERSION=${VERSION} -t herbal3d/convoar .
docker build --no-cache --build-arg TARGET=${TARGET} --build-arg VERSION=${VERSION} -t $DOCKERHUB_USER/convoar .
docker tag $DOCKERHUB_USER/$IMAGE:latest $DOCKERHUB_USER/$IMAGE:$VERSION
fi
if [[ "$DO_DOCKERHUB_PUSH" == "yes" ]] ; then
docker push $DOCKERHUB_USER/$IMAGE:latest
docker push $DOCKERHUB_USER/$IMAGE:$VERSION
fi