-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.sh
executable file
·38 lines (32 loc) · 1.15 KB
/
docker.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
#/bin/bash
set -e
if [ "$#" -lt 1 ]; then
echo "Usage: $0 {build|tag|push}"
exit 1
fi
version=$(jq -r '.version' package.json)
IFS='.' read -r major minor patch <<< "$version"
case $1 in
build)
echo "Building image..."
docker build -t cloudflare-tlsa-generator .
;;
tag)
echo "Tagging image..."
docker tag cloudflare-tlsa-generator smollclover/cloudflare-tlsa-generator:$major.$minor.$patch
docker tag cloudflare-tlsa-generator smollclover/cloudflare-tlsa-generator:$major.$minor
docker tag cloudflare-tlsa-generator smollclover/cloudflare-tlsa-generator:$major
docker tag cloudflare-tlsa-generator smollclover/cloudflare-tlsa-generator:latest
;;
push)
echo "Pushing tagged images..."
docker push smollclover/cloudflare-tlsa-generator:$major.$minor.$patch
docker push smollclover/cloudflare-tlsa-generator:$major.$minor
docker push smollclover/cloudflare-tlsa-generator:$major
docker push smollclover/cloudflare-tlsa-generator:latest
;;
*)
echo "Invalid argument. Usage: $0 {build|tag|push}"
exit 1
;;
esac