-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild_containers.sh
More file actions
executable file
·42 lines (30 loc) · 905 Bytes
/
build_containers.sh
File metadata and controls
executable file
·42 lines (30 loc) · 905 Bytes
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
39
40
41
42
set -e
RED='\033[0;31m'
NC='\033[0m'
REGISTRY=localhost:5000
echo "Building docker images for backend and frontend"
echo "Building backend image"
if [[ -z "${VERSION}" ]]; then
echo "No backend version set, using git short hash"
VERSION=$(git rev-parse --short HEAD);
echo $VERSION
else
echo "Backend version is $VERSION"
fi
echo "Building and tagging backend container\n"
docker build \
-t $REGISTRY/backend:$VERSION \
-f backend/docker/Dockerfile.prod \
./backend/
echo "Building and tagging frontend container"
docker build \
-t $REGISTRY/nginx:$VERSION \
-f nginx/prod/Dockerfile \
.
export CI_REGISTRY_IMAGE=$REGISTRY
export CI_COMMIT_SHORT_SHA=$VERSION
echo "Checking environment variables for swarm"
if [[ -z "${POSTGRES_PASSWORD}" ]]; then
echo "WARNING: ${RED}POSTGRES_PASSWORD not set, exiting.${NC}"
fi
docker stack deploy -c raspi.yml form13-stack