This repository was archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·41 lines (39 loc) · 1.52 KB
/
release.sh
File metadata and controls
executable file
·41 lines (39 loc) · 1.52 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
#!/usr/bin/env bash
node=(6.10.3 8.10.0)
serverless=(1.27.3 1.28.0)
IMAGE_NAME=aproint/aws-codebuild-serverless
for node_version in "${node[@]}"
do
node_major=$(echo $node_version | awk -F. '{print $1}')
tag_node="node${node_major}"
for serverless_version in "${serverless[@]}"
do
#extract major version from sls, i.e. 1.27 from 1.27.3
sls_minor=$(echo $serverless_version | awk 'BEGIN{FS=OFS="."}{NF--; print}')
tag_all="${tag_node}-sls${serverless_version}"
tag_minor="${tag_node}-sls${sls_minor}"
#skip if the image exists
if [[ "$(docker images -q $IMAGE_NAME:$tag_all 2> /dev/null)" == "" ]]; then
docker build \
--build-arg NODE_VERSION=$node_version \
--build-arg SERVERLESS_VERSION=$serverless_version \
-t $IMAGE_NAME \
-t $IMAGE_NAME:$tag_all \
-t $IMAGE_NAME:$tag_minor \
.
docker push $IMAGE_NAME:$tag_all
docker push $IMAGE_NAME:$tag_minor
fi
#skip if the extra image exists
if [[ "$(docker images -q $IMAGE_NAME:$tag_all-extra 2> /dev/null)" == "" ]]; then
docker build \
--build-arg IMAGE_VERSION=$tag_all \
-t $IMAGE_NAME:$tag_all-extra \
-t $IMAGE_NAME:$tag_minor-extra \
-f Dockerfile-extra \
.
docker push $IMAGE_NAME:$tag_all-extra
docker push $IMAGE_NAME:$tag_minor-extra
fi
done
done