S2OJ/install/bundle/hooks/build
Masco Skray e0914a8f31 chore(install/bundle): let Dockerfile get current branch when building
Previous the branch in Dockerfile is specified manually in each branch.
But when someone want to change the branch or test they must modify it.
To make the process more intelligent, we will auto get the branch name.
And, to make the image smaller, we added --single-branch argument onto.
2019-04-20 10:51:03 +08:00

7 lines
185 B
Bash

#!/bin/sh
CLONE_ADDFLAG="-b $DOCKER_TAG"
if [ "$DOCKER_TAG" = "latest" ]; then
CLONE_ADDFLAG="-b master"
fi
docker build -t $IMAGE_NAME --build-arg CLONE_ADDFLAG="$CLONE_ADDFLAG" .