Supporting cases where the user does not wish to define the REGISTRY variable to have the container pushed anywhere.

pull/681/head
Programster 7 years ago
parent 5c508313ee
commit 4e7f0eae6f

@ -22,21 +22,31 @@ cp -f Dockerfile ../../.
cp -f .dockerignore ../../.
cd ../../.
if [[ $REGISTRY ]]; then
TAG="`echo $REGISTRY`/`echo $PROJECT_NAME`"
else
TAG=$PROJECT_NAME
fi
# Ask the user if they want to use the docker cache
read -p "Do you want to use a cached build (y/n)? " -n 1 -r
echo "" # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker build --pull --tag $REGISTRY/$PROJECT_NAME .
docker build --pull --tag $TAG .
else
docker build --no-cache --pull --tag $REGISTRY/$PROJECT_NAME .
docker build --no-cache --pull --tag $TAG .
fi
# Remove the duplicated Dockerfile after the build.
rm $SCRIPTPATH/../../Dockerfile
rm $SCRIPTPATH/../../.dockerignore
docker push $REGISTRY/$PROJECT_NAME
if [[ $REGISTRY ]]; then
docker push $TAG
fi
echo "Run the container with the following command:"
echo "bash deploy.sh"
echo "bash deploy.sh"

@ -15,10 +15,12 @@ cd $SCRIPTPATH
# load the variables
source $SCRIPTPATH/docker_settings.sh
CONTAINER_IMAGE="`echo $REGISTRY`/`echo $PROJECT_NAME`"
if [[ $REGISTRY ]]; then
CONTAINER_IMAGE="`echo $REGISTRY`/`echo $PROJECT_NAME`"
else
CONTAINER_IMAGE="`echo $PROJECT_NAME`"
fi
echo $PROJECT_NAME
echo "============"
docker kill $PROJECT_NAME
docker rm $PROJECT_NAME
@ -38,4 +40,4 @@ docker run -d \
-v $VOLUME_DIR/data:/data \
--restart=always \
--name="$PROJECT_NAME" \
$CONTAINER_IMAGE
$CONTAINER_IMAGE
Loading…
Cancel
Save