-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-images.sh
More file actions
executable file
·58 lines (41 loc) · 1.13 KB
/
Copy pathpublish-images.sh
File metadata and controls
executable file
·58 lines (41 loc) · 1.13 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# publish-images.sh [<arch>] [<version>]
# Load environment variables from .env file if it exists
if [ -r ".env" ]; then
source .env
fi
ARCH=${1:-amd64}
VERSION=${2:-${VCACHE_VERSION:-0.0.0}}
build_image () {
local img=${1}
local ctx=${2:-./context/$img}
local f=${3}
if [ -n "$f" ]; then
f="-f $ctx/$f"
fi
cmd="sudo docker buildx build $ctx $f --pull --no-cache -t private-registry.vivoh.com/vcache-${img}-${ARCH}:${VERSION} --platform linux/${ARCH}"
echo -e "\nrunning: $cmd\n"
$cmd
ret=$?
if [[ $ret != 0 ]]; then
echo "failed to build image: $img ($ret)"
fi
}
push_image () {
local img=${1}
cmd="sudo docker push private-registry.vivoh.com/vcache-${img}-${ARCH}:${VERSION}"
echo -e "\nrunning: $cmd\n"
$cmd
ret=$?
if [[ $ret != 0 ]]; then
echo "failed to push image: $img ($ret)"
fi
}
build_image "nginx-fe" "./context" "nginx/Dockerfile.frontend"
build_image "nginx-be" "./context" "nginx/Dockerfile.backend"
build_image "node-red" "./context" "node-red/Dockerfile.release"
build_image "varnish"
push_image "nginx-fe"
push_image "nginx-be"
push_image "node-red"
push_image "varnish"