-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_push.sh
executable file
·38 lines (31 loc) · 1.23 KB
/
docker_push.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
38
#!/bin/bash
set -e
# Also needs to be updated in Dockerfile when changed.
GROW_VERSION=`cat grow/VERSION`
if [ "$1" == "gcr.io" ]; then
echo "Building and Pushing Grow $GROW_VERSION to gcr.io"
echo " To build and push to Docker hub run './docker_push.sh'"
echo " To build and push to both run './docker_push.sh all'"
fi
if [ "$1" == "" ]; then
echo "Building and Pushing Grow $GROW_VERSION to Docker Hub"
echo " To build and push to gcr.io run './docker_push.sh gcr.io'"
echo " To build and push to both run './docker_push.sh all'"
fi
# Ubuntu Base.
docker build --no-cache --build-arg grow_version=$GROW_VERSION \
-t grow/base:$GROW_VERSION -t grow/base:latest \
-t gcr.io/grow-prod/base:$GROW_VERSION -t gcr.io/grow-prod/base:latest \
- < Dockerfile
docker run --rm=true --workdir=/tmp -i grow/base:$GROW_VERSION \
bash -c "git clone https://github.com/grow/grow.io.git && cd grow.io/ && grow install && grow build"
if [ "$1" == "gcr.io" ] || [ "$1" == "all" ]; then
# Google cloud registry.
docker push gcr.io/grow-prod/base:$GROW_VERSION
docker push gcr.io/grow-prod/base:latest
fi
if [ "$1" == "" ] || [ "$1" == "all" ]; then
# Docker Hub.
docker push grow/base:$GROW_VERSION
docker push grow/base:latest
fi