-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_dockers.sh
executable file
·79 lines (67 loc) · 2.3 KB
/
build_dockers.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# If tarballing references on Mac OS, use --no-xattrs, or better yet use gnu-tar
# https://stackoverflow.com/questions/51655657/tar-ignoring-unknown-extended-header-keyword-libarchive-xattr-security-selinux
if [[ "$1" = "" ]];
then
echo "ERROR: Specify a version number for tagging the images (specific to this repo, not clockwork)"
exit 1
fi
ash_tag=".$1"
official_tag="v0.12.5"
tag=$official_tag$ash_tag
echo "Images will be tagged with $tag"
if [ -d "./references/" ];
then
echo "Found references/ folder."
else
mkdir references
fi
if [ -f "./references/Ref.H37Rv.tar" ];
then
echo "Found indexed H37Rv reference."
else
echo "Place Ref.H37Rv.tar in $pwd/reference"
exit 1
fi
if [ -f "./references/clockwork-v0.12.5/Ref.remove_contam.tar" ];
then
echo "Found default (CRyPTIC) decontamination reference."
else
echo "Place Ref.remove_contam.tar in $pwd/reference"
exit 1
fi
if [[ "$2" != "skipCDC" ]];
then
if [ -f "./references/CDC-varpipe/Ref.remove_contam.tar" ];
then
echo "Found varpipe_wgs (CDC) decontamination reference."
else
echo "Place varpipe.Ref.remove_contam.tar in $pwd/reference"
exit 1
fi
fi
echo "Building slim..."
docker build -f Dockerfile_slim .
docker tag $(docker images | awk '{print $3}' | awk 'NR==2') ashedpotatoes/clockwork-plus:$tag-slim
echo "Pushing slim..."
docker push "ashedpotatoes/clockwork-plus:$tag-slim"
# I use Mac OS, so https://stackoverflow.com/a/62309999 and https://stackoverflow.com/a/4247319 are at play
# (and also the slash needs to be escaped)
base_image_line="FROM ashedpotatoes\/clockwork-plus:$tag-slim"
sed -i '' -e "2s/.*/$base_image_line/" Dockerfile_CRyPTIC
sed -i '' -e "2s/.*/$base_image_line/" Dockerfile_CDC
# build CRyPTIC image
echo "Building CRyPTIC..."
docker build -f Dockerfile_CRyPTIC .
docker tag $(docker images | awk '{print $3}' | awk 'NR==2') ashedpotatoes/clockwork-plus:$tag-CRyPTIC
echo "Pushing CRyPTIC..."
docker push "ashedpotatoes/clockwork-plus:$tag-CRyPTIC"
if [[ "$2" != "skipCDC" ]];
then
# build CDC image
echo "Building CDC..."
docker build -f Dockerfile_CDC .
docker tag $(docker images | awk '{print $3}' | awk 'NR==2') ashedpotatoes/clockwork-plus:$tag-CDC
echo "Pushing CDC..."
docker push "ashedpotatoes/clockwork-plus:$tag-CDC"
fi