-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.sh
64 lines (47 loc) · 1.82 KB
/
tools.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
#!/bin/bash
send-email () {
echo "Sending email..."
subject_string="$1"
project_name="$2"
email_body="$3"
ftp_version="$4"
github_version="$5"
curl --url 'smtps://${smtp_server}:465' --ssl-reqd \
--mail-from '$email_address' \
--mail-rcpt '$email_address' \
--user '${email_address}:' \
-T <(echo -e "From: ${email_address}\nTo: ${email_address}\nSubject: ${subject_string} ${project_name} \n\n ${email_body} FTP version: ${ftp_version} Github version: ${github_version} ")
}
build () {
project_home=$1
project_name=$2
github_version=$3
echo "Building docker image"
docker build --no-cache -t ${project_name} --build-arg CACHEBUST=$(date +%s) --build-arg NAME="${project_name}" --build-arg VERSION="${github_version}" --file ${project_home}/Dockerfile .
#TODO docker build --no-cache -t ${project_name} --build-arg NAME="${project_name}" --build-arg VERSION="${github_version}" --file ${project_home}/Dockerfile .
docker run --name ${project_name} ${project_name}
echo "copying binary"
container_id=$(docker ps -aqf "name=^$project_name$")
docker cp $container_id:/buildah/. $project_home/binary
}
move () {
project_home=$1
project_name=$2
github_version=$3
ssh_key_name=$4
echo "scpin' it!"
#TODO function to put on mirror if we know the right dir to put it in
scp -i ${project_home}/${ssh_key_name} ${project_home}/binary/${project_name}-${github_version} username-${project_name}@${mirror}.org:~/
}
clean () {
project_home=$1
project_name=$2
echo "Cleaning up build, removing images and containers"
container_id=$(docker ps -aqf "name=^$project_name$")
rm $project_home/*.txt
docker rm $container_id
docker rmi $project_name
echo "Clearing cache"
docker system df
docker system prune --force
}